Jump to content

Controlling my autoIT script via exe-file.


Recommended Posts

I was thinking, is there chance to create script, that could be running on computer like 24/7

I've little macro-program, that analyse text in other program, and now it simply saves data in txt-files with cmd.exe.

Macro-program has execute command, and I made little autoit script, that I call as:

execute writeMySQL.exe Param1 Param2

And that writes params in MySQL DB

But problem is, that I can't call that program like 1-10 times in second,

everytime start it, and close again.

How might I could send data for it via execute, and still keep process running,

and saving data in database.

Hope someone understand what I'm looking for, my techinical english kind of suck ^_^

Thanks.

Link to comment
Share on other sites

I think if you create a shortcut for it and execute it with the shortcut will solve your issue - something like - Ctrl+F8 for example...

What you mean with shortcut?

It's same execute the whole script with parameters, than execute shortcut with parameters.

I'll whould somehow could send commands for my currently running script, somehow... But how?

Link to comment
Share on other sites

I mean create a shortcut in your script or lets say assign a key to do an action. So when you press Ctrl+F8 to do the thing you want.That way you can send commands to your script. Check out the HotKeySet() function.

Edited by Juvigy
Link to comment
Share on other sites

What you mean with shortcut?

It's same execute the whole script with parameters, than execute shortcut with parameters.

I'll whould somehow could send commands for my currently running script, somehow... But how?

Hi,

i don't know if its working:

1) Your macro writes param1 and param2 into param.txt with a space between the params

2) In writemysql you having a loop. In the loop you are doing a _FileReadToArray with a StringSplit and Delete File.

Like:

#include <file.au3>
$file = "c:\mysql\param.txt"
While 1
    If FileExist ($file) Then
        _FileReadToArray ($file, $aRecords)
        $param = Stringsplit ($aRecords, " ")
        FileDelete ($file)
        if param [1] = "stop" Then Exit
        ;Now write $param [1] and param [2] into your MySQL DB
    EndIf
    sleep (10)
Wend

You may have problems with the file handle, but try it. For stopping, let your macro write stop stop as params into your txt file.

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

Hi,

i don't know if its working:

1) Your macro writes param1 and param2 into param.txt with a space between the params

2) In writemysql you having a loop. In the loop you are doing a _FileReadToArray with a StringSplit and Delete File.

Like:

#include <file.au3>
$file = "c:\mysql\param.txt"
While 1
    If FileExist ($file) Then
        _FileReadToArray ($file, $aRecords)
        $param = Stringsplit ($aRecords, " ")
        FileDelete ($file)
        if param [1] = "stop" Then Exit
        ;Now write $param [1] and param [2] into your MySQL DB
    EndIf
    sleep (10)
Wend

You may have problems with the file handle, but try it. For stopping, let your macro write stop stop as params into your txt file.

;-))

Stefan

Yeah, I was thinking to write data first in txt file,

but writing data in txt file with cmd.exe, it will always popup the cmd.exe-window quickly...

And that's the thing I want to get rid of...

At long term, it's pretty annoying wathing blinking cmd in screen, while doing stuff ^_^

Link to comment
Share on other sites

Yeah, I was thinking to write data first in txt file,

but writing data in txt file with cmd.exe, it will always popup the cmd.exe-window quickly...

And that's the thing I want to get rid of...

At long term, it's pretty annoying wathing blinking cmd in screen, while doing stuff ^_^

Hi,

bad thing......

So your macro isn't able to write directly into a file without using cmd?

You may translate your macro as well into AutoIT or

Maybe:

1) Write a CMD file, e.g. c:\mysql\writeparam.cmd.

2) In the cmd file: echo %1 %2 >c:\mysql\param.txt

3) In your macro you execute: start /min c:\mysql\writeparam param1 param2

So you write paramaters into a txt file, but the window is minimized. It shouldn't flicker so much.

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

Yeah, I was thinking to write data first in txt file,

but writing data in txt file with cmd.exe, it will always popup the cmd.exe-window quickly...

And that's the thing I want to get rid of...

At long term, it's pretty annoying wathing blinking cmd in screen, while doing stuff ^_^

Just for hiding the cmd screen, check out the @HIDE flag for the Autoit Run and ShellExecute functions. ;)

Link to comment
Share on other sites

Just for hiding the cmd screen, check out the @HIDE flag for the Autoit Run and ShellExecute functions. ^_^

Still using other software for data-analysing...

I've simple autoit script, that now writes data in mysql by:

execute writeMySQL.exe "parameter 1" "Parameter 2"

But should get way to keep script running after first wright, and then command it to write again somehow...

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