echdareez Posted August 5, 2015 Share Posted August 5, 2015 Hi there,New to AutoIT so a warm hello to all of you :-)I've written a script with a GUI and 3 "major" buttons : X, Y and Z. Which happen to correspond to my 3 DVD-drives...As I want to backup all my old CD's, X should start a process on the X:-drive, Y on the Y: and so on... Easy peasy...Each process is as follows :* copy files (robocopy / xcopy)* create a checksum on those files (fsum)* verify the contents of the original CD with the files copied to the harddisk (csdiff)Robocopy / fsum and csdiff are all "cli-operated" so each CD takes about 5 to 10 minutes before being "ready".Is there a way in AutoIT that can create such a "child" process? Launch a "block" of three files and goes back to the main? So I can press the Y: button while X: is busy?Hope everything is clear with the above :-)/dimi Link to comment Share on other sites More sharing options...
JohnOne Posted August 5, 2015 Share Posted August 5, 2015 You will need to clarify a little. A lot would be better, but a little might get you understood.For example, how are you starting this command? etcetera... AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
echdareez Posted August 6, 2015 Author Share Posted August 6, 2015 Morning John1,Perhaps I do indeed My pleasure so here it goes :First up : the rudimentary GUI :The red string is something that's being kept in the registry and can be changed with the EditLoc button (that works already)The 3 X/Y/Z buttons are triggered as follows :Case $XButton CopyFromDrive("X:") Case $YButton CopyFromDrive("Y:") Case $ZButton CopyFromDrive("Z:")And the CopyFromDrive is the following function :Func CopyFromDrive($DriveSelector) ; *********** DRIVE CLOSE BEFORE STARTING *********** CDROM_Close ($DriveSelector) GUICtrlSetData ($StatusLabel_A, "Drive : " & $DriveSelector) ; *********** CREATE DIRECTORIES *********** For $Count_Thousands = 0 To 9 If $Count_Hundreds = 9 Then $Count_Hundreds = 0 If $Count_Singles = 9 Then $Count_Singles = 0 For $Count_Hundreds = 0 To 9 If $Count_Singles = 9 Then $Count_Singles = 0 For $Count_Singles = 0 To 9 If FileExists ($TempVariable & "\" & $Count_Thousands & $Count_Hundreds & $Count_Singles) Then Else DirCreate ($TempVariable & "\" & $Count_Thousands & $Count_Hundreds & $Count_Singles) $Count_Thousands = 9 $Count_Hundreds = 9 $Count_Singles = 9 EndIf Next Next Next ; *********** COPY DATA FROM CD *********** Run("xcopy " & $DriveSelector & "\*.* " & $LocVariable & " /E /S", "", @SW_HIDE) GUICtrlSetData ($StatusLabel_A, "Error : " & @error) ; *********** CREATE A CHECKSUM ********** Run("x:\tools\CLI\fsum", "", @SW_HIDE) ; placeholder! options to be added ; *********** COMPARE SOURCE WITH DESTINATION ********** Run("x:\tools\CLI\csdiff", "", @SW_HIDE) ; placeholder! options to be added ; *********** OPEN DRIVE, READY FOR THE NEXT ONE *********** CDROM_Open ($DriveSelector) EndFuncSo : I insert a CD into the corresponding tray, I push the corresponding button and what happens next is :1. the tray is closed2. the destination directory is created (going from 000 to 999)3. the data is copied from the CD4. a MD5 checksum is created on the destination (the fsum line)5. the data is one last time compared against the source6. the tray is opened againI'll do my best to explain this : my issue is that the above works as a "single" process : you push the X: button eg, I wait for 10 minutes as it goes through the function and when it's done, I can push the Y: button. But I would like to know if this can be made as a "multi" process : I push the X: button and while it's doing its thing, I can also push the Y: button.Hmm, is it apparent to see that I'm new to this? /dimi Link to comment Share on other sites More sharing options...
echdareez Posted August 6, 2015 Author Share Posted August 6, 2015 (edited) I initially thought I had it running : First I thought Oh my... Oh my... The shame... The horror... After posting the above, I thought : who said I can't push the Y: button? Perhaps it's already functional as it is, so I changed :Case $XButton PingWait() Case $YButton PingWait() Case $ZButton PingWait()And with this function :Func PingWait() Run ("cmd /c PING 127.0.0.1 -n 60 >NUL 2>&1 || PING ::1 -n 60 >NUL 2>&1") EndFuncAnd yes, it worked as expected So.. It was a non-issue after all thanks though!/dimiAnd again shortly after : I realized I'm still stuck and I misinterpreted the way the Run() works :Added some extra testing to be sure (2 Statuslabels that were updated on the GUI) and noticed that the labels were updated immediately (while the pings were still running). Changed the Run() to Runwait() as follows :Func WaitPing10() RunWait ("cmd /c PING 127.0.0.1 -n 10 >NUL 2>&1 || PING ::1 -n 10 >NUL 2>&1") GUICtrlSetData ($StatusLabel_A, "10 DONE") EndFunc Func WaitPing60() RunWait ("cmd /c PING 127.0.0.1 -n 60 >NUL 2>&1 || PING ::1 -n 60 >NUL 2>&1") GUICtrlSetData ($StatusLabel_B, "60 DONE") EndFuncTied the WaitPing10 to the Y-button, the WaitPing60 to the Z-button and yes, pressing the Y-button triggered the first ping but pressing the Z-button (while the Y-button process was still running) did nothing...So... Any suggestions? /dimi Edited August 6, 2015 by echdareez Too hasty 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