Script Packager - Retain script names

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.
This topic is 16 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Travis.Golliher@aps.com
Posts: 6
Last visit: Fri Nov 02, 2012 9:49 am

Script Packager - Retain script names

Post by Travis.Golliher@aps.com »

An option to leave script names unchanged in a script package. That way if your using things like Wscript.ScriptName you can actually rely on it coming back with the intended name and not a randomly generated script name. Along with that option could be an optional overwrite existing files.

For example, I have test.vbs which relies on a supporting ini file named test.ini. When I script for this I will have it get the filename (without extension) of the running vbs which is "test" and add a .ini extension to find the supporting "test.ini". Currently when the script is packaged this functionality breaks because the script name is randomly generated, but the ini file name is retained because it's in the data files area.

This is just one example, but I can think of quite a few other things that would benefit from having these options added.Travis.Golliher@aps.com2008-02-05 11:05:27
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 20
Been upvoted: 37 times

Script Packager - Retain script names

Post by Alexander Riedel »

Unfortunately there is a reason it uses random names.

If you run multiple instances of a packaged script using the external engine (CScript or WScript) each instance needs its own copy of the script.

Alex
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Travis.Golliher@aps.com
Posts: 6
Last visit: Fri Nov 02, 2012 9:49 am

Script Packager - Retain script names

Post by Travis.Golliher@aps.com »

Not sure I follow you.
Once the script has been loaded into memory by cscript or wscript the vbs file can be deleted. So if I ran the package the first time, and it's still running when I run it the second time it would overwrite the first copy of the script and run it regardless and both packages would finish just fine. This is because it's already loaded in memory by cscript or wscript.

It must be more complicated than that?
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

Script Packager - Retain script names

Post by donj »

It is. If you're using WScript/CScript, the script file has to remain on-drive for the duration of execution. WScript and CScript don't load the entire script into memory for execution, and they can lock the file so that another process wouldn't be able to access it properly.

So, if you ran Package A and it wrote the scripts, and then ran it again, the second instance might still be running when the first finished and tried to delete the files.

In essence, the random names keep two instances of the package from stomping on one another.donj2008-02-05 11:49:05
User avatar
Travis.Golliher@aps.com
Posts: 6
Last visit: Fri Nov 02, 2012 9:49 am

Script Packager - Retain script names

Post by Travis.Golliher@aps.com »

Why not tag each package with a GUID and not allow more than one instance of the package to run when the person opts to leave the script name intact? Just note it in the docs as a known limitation. I'd rather have the ability with that caveat than not have it at all. :)
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

Script Packager - Retain script names

Post by donj »

We'll certainly let the dev team take it under advisement! They do try not to make things overly complex, and I'm sure you know folks' track record for reading the docs :), but perhaps they'll come up with something elegant in a future build.
This topic is 16 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked