Jump to content

Scripting a program to save a file in the correct directory

Recommended Posts

I do PC repair for a living, and after a few too many cases of losing important information after reinstalling Windows, I'd like to find a solution. Nirsoft has a number of utilities that look useful. In particular, I'm trying to script the ProduKey utility, so all I have to do is run the script, and it saves the Windows key to a date-named file. The ProduKey program has command line options to do this, but I haven't been able to get them to work. So, I'm trying to script it in AutoIt. I've gotten as far as running the program, selecting the keys, and opening a save dialog. I have no idea how to get past this point. At least on my computer, it defaults to saving in 'My Documents', which may or may not be getting backed up. Since I may run this utility over the network, or a USB drive, I'd like it to just save it in the directory the program was run from.


Can this be done?


Share this post

Link to post
Share on other sites

There is a macro called @scriptdir in the help file.  If you save to:


It should save to the place from where you ran the script.  You don't need a save dialog to do that.  In fact, if you always want to save it in the same location why have a dialog?

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

  • Create New...