Jump to content
Sign in to follow this  
Gambler71

Name Of File That Called My Script

Recommended Posts

Gambler71

I have made a script to do what I need, and compiled it (called "MYMAIN.exe").

What I want to do is make a file with extension ".wfr", associate it to run the compiled script "MYMAIN.exe".

I have done that bit.

In the ".wfr" file, I have a basic ini file.

The ".wfr" file and the compiled script "MYMAIN.exe" will always be in different directories.

The ".wfr" files will vary in name (e.g. "happy.wfr", "balloon.wfr").

What I need to know is the name of the ".wfr" file that called the exe file.

I tried "@ScriptName" but that gave me "MYMAIN.exe".

I tried "@WorkingDir" but that only tells me what directory the ".wfr" file is in, but not its name.

I can get it to work if "MYMAIN.exe" is in the same dir as the ".wfr", but the ".wfr" had to be named "MYMAIN.wfr", and I would then end up with hundreds of "MYMAIN.exe" files all over my harddrive. I would like to have just 1 "MYMAIN.exe" (so I can edit just 1 copy if need be) but multiple ".wfr" files, with various names.

Thanks in advance.

Share this post


Link to post
Share on other sites
Gambler71

My bad, it was there all along. I just needed to use $CmdLine[1] to capture it.

Thanks

Edited by Gambler71

Share this post


Link to post
Share on other sites
sleepydvdr

I don't think you looked in to what Jos said. Read this:

http://www.autoitscript.com/autoit3/docs/intro/running.htm

The key part you want to concentrate on is: $CmdLine[1]. $CmdLine[1] is a special function that can return the path of the "*.wtr" file that launches your executable.

Check out something I wrote recently that did basically what you are trying to do:


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×