Script Packager in PS 2009

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
Locked
User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Script Packager in PS 2009

Post by clum09 » Sat May 30, 2009 5:39 am

Hello,

I see that Primal Script 2009 has additional features with its Script Packager.

Will the Script Packager in Primal Script 2009 will have the follow features when packaging the VBscript?

1. The packaged script (the executable file with the .exe extension) can extract the script file, the icon file and other utility files to another folder different from the one where the packaged script resides.

2. The log files that are generated by the packaged script can be placed in the folder where the packaged script resides.

Admin Script Editor script editor can allow this option with the environment variable when the pakcaged script launches.

I would like to see this feature in Primal Script 2009.

Thank you for the help.



User avatar
Alexander Riedel
Posts: 7121
Joined: Tue May 29, 2007 4:43 pm

Script Packager in PS 2009

Post by Alexander Riedel » Sat May 30, 2009 5:44 am

1. This has always been available. Maybe I don't understand completely what you are asking for. Why would you extract the icon file from executable?
2. What log files are you referring to? The script's output?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Script Packager in PS 2009

Post by clum09 » Mon Jun 01, 2009 1:52 am


OK. Maybe I did not make my point clear enough.

When I package a VBScript script to become a self-executable file, I can add the icon file and other utility files that I might use for the script do other tasks that VBScript cannot do, and I can set the location for self-executable script file to extract the script file, the icon file and other utility files to another folder during execution. The VBscript code in my original script that I use to package into the self-executable file will generate some output log files as the reports that I can see later how the results from the script will look like.

Because the location of these other files (the icon file, the script file and other utility files) is at different folder rather than the folder where the self-executable script resides, the output log files generated by the script will also be in the folder where these other files are in. As a result, I can never see the output log files in the folder where the self-executable script file is located. I have to see the log files in the folder where these other files are located. If I set the option to delete these other files after the script has finished it execution, I can never see my log files

User avatar
Alexander Riedel
Posts: 7121
Joined: Tue May 29, 2007 4:43 pm

Script Packager in PS 2009

Post by Alexander Riedel » Mon Jun 01, 2009 3:11 am

First of all, you have options to set the folder for your data files to where the exe is. You have full control over where those files go. It is probably best if you specify a specific folder for your particular script, but
if you use the SAPIEN Script Host, your WScript.FullName property will point to your own executable.
So I am not quite sure what you are missing here.

I am not sure I understand "PS Script Packager cannot pipe the log files". "Pipe" usually refers to a command line redirection. Is that what you are talking about?

Last but not least, you shouldn't simply assume in your script that you can write to the folder where your exe is.
If you want to treat your packaged exe like any other application and install it under the Program Files folder, you will not be able to write to that folder from a script anyway. At least not from Windows Vista on forward.

Do you use the command line version of the packager or the dialog version of it?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Script Packager in PS 2009

Post by clum09 » Wed Jun 03, 2009 2:43 am

Alex,

I never have the packaged self-executable script in the Program Files folder. There is no piping cmd command to redirect the log files either - this is purely vbscript FSO object to write the text files as the log files to the current folder where the vbscript file itself resides.

I remove the icon file and the utility files away from this discussion for simplicity. What I meant is as follows:

When I package the vbscript in Primal Script, it will ask me where the temporary folder for it to extract the vbscript file to during the execution of the packaged script.

The vbscript code that I have will write some log files to the current folder where the vbscript file is located. If I tell PS Packager to place this vbscript file in the same folder as the packaged script file (the one with .exe extension), this will allow the log files to be written to the folder where the packaged script resides, but the vbscript file that is extracted into the folder by the packaged script will also be seen inside the folder where the packaged script is. This is not desirable since I don

User avatar
Alexander Riedel
Posts: 7121
Joined: Tue May 29, 2007 4:43 pm

Script Packager in PS 2009

Post by Alexander Riedel » Wed Jun 03, 2009 3:34 am

Sure, use the SAPIEN Script Host and use the WScript.FullName to find out where the exe is.
Create your logs there. No temporary script files.

I have to point out that your script should not rely on that folder being writable though. It would be much better practice if your code would create and use a specific folder for its output in the users application data folder.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Script Packager in PS 2009

Post by clum09 » Wed Jun 03, 2009 4:54 am

Alex,

I need to know the location of the folder where the packaged script resides as the base location. From here, I can create a subfolder for the log files if I want to.

Are you saying that I need to use the SAPIEN Script Host (Command line) option and the Wscript.FullName method to point to the current folder so that the log files can be written to packaged script's folder?

With the SAPIEN Script Host (Command line) option, there is no vbscript file to be extracted before the script will run. Is this correct?

What about the Manifest option? Which one do I select?


User avatar
Alexander Riedel
Posts: 7121
Joined: Tue May 29, 2007 4:43 pm

Script Packager in PS 2009

Post by Alexander Riedel » Wed Jun 03, 2009 6:25 pm

Yes this is all correct. WScript.FullName points to your EXE if you use the SAPIEN Script Host.

Please consult the included manual for further details on the available options. I cannot tell which version you have and and what your needs for a manifest, if any, are.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Script Packager in PS 2009

Post by clum09 » Wed Jun 03, 2009 11:05 pm

I tried to package the vbscript using SAPIEN Script Host (Command line) with my script that has some command line arguments that the user can supply or not supply depending the need the user wants.
However, the argument part does not work as expected. I have the options for user to either input arguments or without inputing any arguments, but the packaged script keeps asking for arguments all the time. The vbscript file by itself works just fine.
So far I have not seen how the SAPIEN Script Host working yet.
Any idea why?












User avatar
jhicks
Posts: 1789
Joined: Sun Jan 21, 2007 11:31 pm

Script Packager in PS 2009

Post by jhicks » Thu Jun 04, 2009 12:14 am

Here's a test script I packaged using SAPIEN Script Host (command line)sHost=WScript.FullNamewscript.Echo "My path is " & WScript.Pathwscript.echo "I am using " & sHostSet objNetwork=CreateObject("WScript.Network")WScript.Echo objNetwork.UserNameIf WScript.Arguments.Named.Exists("foo") Then WScript.Echo "You passed " & WScript.Arguments.Named("foo")End IfYou should get some information when you run the exe from the command line. To test passing an argument add /foo:somevalueDoes this work for you? You should be able to use wscript.path to identify the current directory.

Locked