Jump to content

Name Of File That Called My Script


Recommended Posts

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.

Link to comment
Share on other sites

  • Developers

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.
  :)

Link to comment
Share on other sites

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>

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...