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 LICENSE NUMBERS, ACTIVATION 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.
This topic is 15 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.
User avatar
clum09
Posts: 150
Last visit: Sun Jan 21, 2024 5:07 pm

Output file to the current script folder

Post by clum09 »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Output file to the current script folder

Post by Alexander Riedel »

What type of script are you packaging?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
clum09
Posts: 150
Last visit: Sun Jan 21, 2024 5:07 pm

Output file to the current script folder

Post by clum09 »

VBscript.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Output file to the current script folder

Post by Alexander Riedel »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Output file to the current script folder

Post by Alexander Riedel »

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
Last visit: Sun Jan 21, 2024 5:07 pm

Output file to the current script folder

Post by clum09 »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Output file to the current script folder

Post by Alexander Riedel »

Moving topic to the appropriate forum.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Output file to the current script folder

Post by Alexander Riedel »

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.
This topic is 15 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.