friends Posted July 29, 2004 Posted July 29, 2004 Hi all. I stuck in somewhere of my script, where i wonder which command to use if i wanted : * continue a next statement after a previous statement has been completed, whereby the process time may be vary from time to time, cos that particular task is being processed. In short, which command to use to check if a previous statement is completed before I can continue the next ? Need help.... thanks
dooshorama Posted July 29, 2004 Posted July 29, 2004 that is so vague, i'm not sure it makes sense. what statement exactly?
CyberSlug Posted July 29, 2004 Posted July 29, 2004 Is your script doing anything else while that you are waiting for that "process" to complete? Generally--with some notable exceptions--the script does not continue until the previous statement is complete.... Maybe a specific example would help Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
friends Posted August 1, 2004 Author Posted August 1, 2004 Is your script doing anything else while that you are waiting for that "process" to complete? Generally--with some notable exceptions--the script does not continue until the previous statement is complete.... Maybe a specific example would help <{POST_SNAPBACK}>well... the script will continue only after that "process" is completed. Because of the process time may be vary.... example as shown below : 1) Script perform telnet to a server 2) login using username and password 3) perform a task for server (extract_urgent.sh) During this "extract_urgent.sh", it takes time, but we are not sure how long the server will take to process. 4) Then only continue other process.... my question is... while waiting for STEP 3 to complete before I can continue the rest, what command should I use ? Cos server progress the "extract_urgent.sh" time is vary everytime when you execute it. Please show me an example if you know which command / statement to be used for that. Thanks
emmanuel Posted August 2, 2004 Posted August 2, 2004 my question is... while waiting for STEP 3 to complete before I can continue the rest, what command should I use ? Cos server progress the "extract_urgent.sh" time is vary everytime when you execute it. Please show me an example if you know which command / statement to be used for that. Thanks <{POST_SNAPBACK}>well, you need to see if there's anything that changes in your telnet app that autoit can see, use the window spy to watch your app as it goes from running the extract_urgent.sh to being done... maybe you'll have to configure the telnet app to keep a log and have autoit read the log file to see if it's done? Something like that... if autoit window spy can detect a change in window title or text upon completion, just use winwait("title", "job done text") to pause the script until the text of the window matches... "I'm not even supposed to be here today!" -Dante (Hicks)
Administrators Jon Posted August 2, 2004 Administrators Posted August 2, 2004 Is it possible to get the .sh script to "exit" and force the host application to close and then you could detect this and relaunch it to carry on? Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
friends Posted August 3, 2004 Author Posted August 3, 2004 well, you need to see if there's anything that changes in your telnet app that autoit can see, use the window spy to watch your app as it goes from running the extract_urgent.sh to being done... maybe you'll have to configure the telnet app to keep a log and have autoit read the log file to see if it's done? Something like that... if autoit window spy can detect a change in window title or text upon completion, just use winwait("title", "job done text") to pause the script until the text of the window matches... <{POST_SNAPBACK}>the windows title is FIXED... where if i connect to 192.168.24.2, the windows title is "Telnet 192.168.24.2".... then only i proceed whatever I should do. in the DOS-based... the Windows Spy cannot "detect" whatever text in the DOS ! I wonder what command I should use to detect that particular job (script in linux) is completed ? NOTE : the extract_urgent.sh cannot be modified as it is done by my HeadQuater Please help.... cos I need to complete this script so that it is ease for my usage. It is very tedious to telnet here and there.... cos total have 3 servers I need to telnet. Here's my script i wrote (my very 1st GUI-AutoIT3) : =================================== ; will create a dialog box that when displayed is centered GUICreate ("TSRMS - Server Job Functions", 400, 400) ; Set Fonts to the Label Text $font = "Arial" GUISetControl ("Label", "Select the options below which you wish to perform :", 25, 15) GUISetControlFont (-1, 10, 800, $font) GUISetControl ("Label", "MD Server", 25, 60) GUISetControlFont (-1, 14, 800, $font) GUISetControl ("Label", "_________________________________________________", 25, 77) GUISetControlFont (-1, 10, 400, $font) $btExtractUrgent = GUISetControl ("Button", "Extract Urgent", 30, 105, 90, 40) ; will display an empty dialog box GUIShow() WHILE 1 $msg = GUIMsg() SELECT CASE $msg = -3 Exit CASE $msg = $btExtractUrgent RUN ("cmd.exe") SEND ("telnet 192.168.24.3 {ENTER}") IF WinExists ("cmd.exe", "") THEN WinActivate ("C:\WINDOWS\System32\cmd.exe", "") ENDIF Telnet() MsgBox (0, "Bravo...", "Job Completed !") ENDSELECT WEND FUNC Telnet() ;$PID = RunWait(@COMSPEC & " /c " & "telnet 192.168.24.3") ;IF $PID = 1 THEN ; Run DOS command in hidden window ;$PID = Runwait (@COMSPEC & " /c """ & "dir/s""", "", @SW_HIDE) SLEEP(10000) SEND ("store{ENTER}") SLEEP(2000) SEND ("erots{ENTER}") SLEEP(8000) SEND ("free -m{ENTER}") SLEEP(8000) ;ENDIF ;ProcessWaitClose ($PID) ENDFUNC
emmanuel Posted August 3, 2004 Posted August 3, 2004 Yeah, I figured if you were using plain ol' telnet that'd be the case, but there's more out there than just the "DOS" telnet. Like PuTTY... Now, it looks like my ISP went and turned shell access off on my domain, so I'm not able to test this... But Putty does have logging options, you can have it log the output that's printed to the screen to a file, then have autoit read that file to command it on what to do...the windows title is FIXED... where if i connect to 192.168.24.2,the windows title is "Telnet 192.168.24.2"....then only i proceed whatever I should do.in the DOS-based... the Windows Spy cannot "detect" whatever text in the DOS !I wonder what command I should use to detect that particular job (script in linux)is completed ?NOTE : the extract_urgent.sh cannot be modified as it is done by my HeadQuaterPlease help.... cos I need to complete this script so that it is ease for my usage.It is very tedious to telnet here and there.... cos total have 3 servers I need totelnet. I'm not being mean, but asking us to assign priority for something based on your need of convienience isn't exaclty the most flattering method of asking more likely to get a good response would be "I've tried X and X, read Y and Y, and how does XY work" do some of the footwork yourself If you're new to autoit, check out this "Where to get started" and do some reading... "I'm not even supposed to be here today!" -Dante (Hicks)
dooshorama Posted August 4, 2004 Posted August 4, 2004 i recommend using EXPECT for windows to do your telnet stuff. when it's done write to a file. in AutoIT check for existance of that file, then continue.
emmanuel Posted August 4, 2004 Posted August 4, 2004 something that might help, I just noticed that puTTY has a "copy all to clipboard" which would be a easy thing to have autoit command it to do, then you use ClipGet() to get that into a variable and check it for your complete message or whatever... "I'm not even supposed to be here today!" -Dante (Hicks)
friends Posted August 6, 2004 Author Posted August 6, 2004 Yeah, I figured if you were using plain ol' telnet that'd be the case, but there's more out there than just the "DOS" telnet. Like PuTTY... Now, it looks like my ISP went and turned shell access off on my domain, so I'm not able to test this... But Putty does have logging options, you can have it log the output that's printed to the screen to a file, then have autoit read that file to command it on what to do... I'm not being mean, but asking us to assign priority for something based on your need of convienience isn't exaclty the most flattering method of asking more likely to get a good response would be "I've tried X and X, read Y and Y, and how does XY work" do some of the footwork yourself If you're new to autoit, check out this "Where to get started" and do some reading... <{POST_SNAPBACK}>well... thanks for the suggestions ! I pasted out my bad coding due to i'm not sure which kind of command available or suitable for my kind of usage, especially telnet stuffs. now... at least i know i can use PUTTY to capture the output and read from a file.... I have no meaning to ask u guys to write out the fully working script for me.... sorry if i have given you a wrong impression. anyway... thanks for the helps ! i'll try it out......
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