Gambler71 Posted July 26, 2011 Posted July 26, 2011 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.
Developers Jos Posted July 26, 2011 Developers Posted July 26, 2011 Add "%1" at the end the association you made for your extension and you can then read the commandline with $cmdline. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Exit Posted July 26, 2011 Posted July 26, 2011 Why don't use *.lnk files (associations) ? App: Au3toCmd UDF: _SingleScript()
Gambler71 Posted July 26, 2011 Author Posted July 26, 2011 (edited) My bad, it was there all along. I just needed to use $CmdLine[1] to capture it. Thanks Edited July 27, 2011 by Gambler71
sleepydvdr Posted July 27, 2011 Posted July 27, 2011 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>
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now