Jump to content

Updating arguments used to launch AutoIt script


Recommended Posts

Hello,

Had a hard time to search for this, maybe because it's like trying to define a vague mist in the distance... so there is also no code with this post :)

I don't yet know anything about SendMessage, etc, etc (I think this is what I need to use), but here goes.

What I am hoping is the following:

Running my MainApp.exe

When the user makes a choice and clicks a button, an AutoIt script (AI.exe) is launched and a set of arguments are sent when the script is launched.

For example: $AIapp = Run("AI.exe" & "Folder1" & "Folder2", @ScriptDir, @SW_Hide)

- this script watches these folders and if MainApp.exe is closed these folders are deleted

While using MainApp.exe, some new choices are made and a new set of folders needs to be watched by AI.exe.

MainApp.exe is already pre-built so I can't change how it works, but I can tell it to send commands, "messages", etc, on demand or on a timer.

Any thoughts (keeping to the lower earth atmosphere) how I can achieve this?

Thanks for your help,

Dean

Link to comment
Share on other sites

What about just Closing the AI.exe using

While ProcessExists(AI.exe)

ProcessClose(AI.exe)

WEnd

Then Run the new AI.exe with previous and new paramters?

Store the previous parameters to a variable and then just append to the new AI.exe

$newparam = $previous & $added

Run("AI.exe " & $newparam)

Link to comment
Share on other sites

Hey rogue5099,

That's a good & simple idea. I ran into a (mental) block trying to figure out how to tell AI.exe that it was getting more parameters, but of course, by concatenating the old and new variables into a single variable would work fine.

(Maybe it's beyond comprehension, but how "long" can an argument be??)

The only foreseeable problem is can I do this While..WEnd from "within" AI.exe (commit suicide and then reincarnate yourself)? I don't have a way to run this routine from MainApp.exe.

Or would I tell MainApp.exe to run preAI.exe (which contains the While...WEnd statement) and then have preAI.exe launch AI.exe?

Thanks,

Dean

Edited by MadDogDean
Link to comment
Share on other sites

Doing that wouldn't work. A PreAI.exe would only keep the current Variable parameter.

Without having full control of storing the information (maybe storing in another file i.e. .ini) you would be wasting time lauching a PreAI.exe.

If you did store the parameters in a .ini using a PreAI.exe then having PreAI.exe read saved parameters, adding new parmeters, close current AI.exe and then Run AI.exe with combined parameters then have PreAI.exe Exit.

A lot of work. maybe a better solution but without controlling MainApp.exe that's best I can offer....

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