Output file to the current script folder

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Output file to the current script folder

Post by clum09 » Mon Feb 23, 2009 12:42 am

Hello,

How can I write the output file from a packaged script to the current script folder?

Is there any PrimalScript specific environment variable that I need to parse to get the folder path where the packaged script resides?

Thanks.

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

Output file to the current script folder

Post by Alexander Riedel » Mon Feb 23, 2009 4:58 am

What type of script are you packaging?
Alexander Riedel
SAPIEN Technologies, Inc.

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

Output file to the current script folder

Post by clum09 » Mon Feb 23, 2009 5:41 am

VBscript.

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

Output file to the current script folder

Post by Alexander Riedel » Mon Feb 23, 2009 6:04 am

It really depends what packaging options you use, but
WScript.Path
should work like in any other VBScript.
Or am I missing something?

Alex
Alexander Riedel
SAPIEN Technologies, Inc.

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

Output file to the current script folder

Post by Alexander Riedel » Mon Feb 23, 2009 6:06 am

Please also do not post PrimalScript questions in the Free Tools section.
Use the proper technical support forum.
Alexander Riedel
SAPIEN Technologies, Inc.

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

Output file to the current script folder

Post by clum09 » Mon Feb 23, 2009 6:11 am

I tried to write a log file from the packaged script without any path statement for the log, but the log file is written to the folder where the script extracted the file.

Instead writing the output file to the temp folder to which the packaged script extracted the script file, I want to write the log file to the current folder where the packaged script resides. How can that be done?

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

Output file to the current script folder

Post by Alexander Riedel » Mon Feb 23, 2009 6:15 am

Moving topic to the appropriate forum.
Alexander Riedel
SAPIEN Technologies, Inc.

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

Output file to the current script folder

Post by Alexander Riedel » Mon Feb 23, 2009 6:16 am

The best way to do this is to tell the packager not to use the temp folder.
That way you can be sure your script runs in the same fodler as the exe.
Alexander Riedel
SAPIEN Technologies, Inc.