JesuZ Posted May 6, 2009 Share Posted May 6, 2009 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 More sharing options...
Juvigy Posted May 6, 2009 Share Posted May 6, 2009 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... Link to comment Share on other sites More sharing options...
JesuZ Posted May 6, 2009 Author Share Posted May 6, 2009 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 More sharing options...
Juvigy Posted May 6, 2009 Share Posted May 6, 2009 (edited) 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 May 6, 2009 by Juvigy Link to comment Share on other sites More sharing options...
99ojo Posted May 6, 2009 Share Posted May 6, 2009 (edited) 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 May 6, 2009 by 99ojo Link to comment Share on other sites More sharing options...
JesuZ Posted May 6, 2009 Author Share Posted May 6, 2009 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. ;-)) StefanYeah, 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 More sharing options...
99ojo Posted May 6, 2009 Share Posted May 6, 2009 (edited) 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 orMaybe:1) Write a CMD file, e.g. c:\mysql\writeparam.cmd.2) In the cmd file: echo %1 %2 >c:\mysql\param.txt3) In your macro you execute: start /min c:\mysql\writeparam param1 param2So you write paramaters into a txt file, but the window is minimized. It shouldn't flicker so much.;-))Stefan Edited May 6, 2009 by 99ojo Link to comment Share on other sites More sharing options...
Graywalker Posted May 6, 2009 Share Posted May 6, 2009 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 More sharing options...
JesuZ Posted May 6, 2009 Author Share Posted May 6, 2009 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 More sharing options...
Juvigy Posted May 7, 2009 Share Posted May 7, 2009 Did you check the HotKeySet() function? It is exactly what you need. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now