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?

Thanks!

Link to comment
Share on other sites

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

@scriptdir&"\myfile.txt"

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?

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

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