Cyri Posted November 16, 2009 Share Posted November 16, 2009 Why does the DirCopy in the following code make the splashtext window hang until the DirCopy is finished? $hWnd = SplashTextOn("Test", "Testing", 400, 150) If DirCopy("C:\backup\test", "\\server\test", 1) Then ControlSetText("", "", $hWnd, "Success") Sleep(3000) Else ;Problem copying SplashOff() MsgBox(48, "Warning", "There was a problem.") EndIf This happens when the folder being copied is quite large so it takes time to copy it out to the server. All the while my SplashText window is hung until it completes the DirCopy. Link to comment Share on other sites More sharing options...
GEOSoft Posted November 16, 2009 Share Posted November 16, 2009 Why does the DirCopy in the following code make the splashtext window hang until the DirCopy is finished? $hWnd = SplashTextOn("Test", "Testing", 400, 150) If DirCopy("C:\backup\test", "\\server\test", 1) Then ControlSetText("", "", $hWnd, "Success") Sleep(3000) Else ;Problem copying SplashOff() MsgBox(48, "Warning", "There was a problem.") EndIf This happens when the folder being copied is quite large so it takes time to copy it out to the server. All the while my SplashText window is hung until it completes the DirCopy. Because the If DirCopy("C:\backup\test", "\\server\test", 1) won't return anything until the copy has either succeeded or failed. Not to mention the Sleep(3000) which does nothing except delay the script. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Cyri Posted November 16, 2009 Author Share Posted November 16, 2009 Because the If DirCopy("C:\backup\test", "\\server\test", 1) won't return anything until the copy has either succeeded or failed. Not to mention the Sleep(3000) which does nothing except delay the script.With sleep aside, this sounds like its by design then. Have any suggestions on a workaround? Will this same issue occur with a GUI created with GUICreate? Link to comment Share on other sites More sharing options...
GEOSoft Posted November 16, 2009 Share Posted November 16, 2009 With sleep aside, this sounds like its by design then.One might construe as being by design, yes. Have any suggestions on a workaround? Will this same issue occur with a GUI created with GUICreate?It applies to anything simply because DirCopy()(as well as FileCopy()) has no return value until the copy is completed.If you dig deeply into example scripts you will find some code for using a progress bar with FileCopy() to indicate the current status of the operation since that appears to be what you want. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Cyri Posted November 16, 2009 Author Share Posted November 16, 2009 I just want it to show the text on the splash screen to the user. When the DirCopy kicks off the text in the splash window goes away. All I can see is the text in the title bar and I have an hourglass if I mouse over it. It still allows me to move the window around though. Link to comment Share on other sites More sharing options...
GEOSoft Posted November 16, 2009 Share Posted November 16, 2009 (edited) SplashTextOn("Test", "Testing", 400, 150) If DirCopy("C:\backup\test", "\\server\test", 1) Then SplashTextOn("Test", "Finished Copying") Sleep(3000) SplashOff() Else ;Problem copying SplashOff() MsgBox(48, "Warning", "There was a problem.") EndIf Edited November 16, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted November 16, 2009 Share Posted November 16, 2009 (edited) Or better SplashTextOn("Test", "Testing", 400, 150) If DirCopy("C:\backup\test", "\\server\test", 1) Then SplashTextOn("Test", "Finished Copying") Sleep(3000) Else ;Problem copying MsgBox(48, "Warning", "There was a problem.") EndIf SplashOff() Edited November 16, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Cyri Posted November 16, 2009 Author Share Posted November 16, 2009 Or better SplashTextOn("Test", "Testing", 400, 150) If DirCopy("C:\backup\test", "\\server\test", 1) Then SplashTextOn("Test", "Testing", "Finished Copying") Sleep(3000) Else ;Problem copying MsgBox(48, "Warning", "There was a problem.") EndIf SplashOff() I looked over the File/Folder Copy with progress topics, but they still rely on FileCopy which will cause the GUI to hang if it's a large file. I think I'm going to go ahead and shell out my copy to either an external AutoIT, xcopy, or robocopy and be done with it. Link to comment Share on other sites More sharing options...
Yashied Posted November 16, 2009 Share Posted November 16, 2009 #Include <Constants.au3> $hWnd = SplashTextOn('Test', 'Testing', 400, 150, 100, 100, 16) GUISetCursor(15, 1, $hWnd) $PID = Run(@ScriptDir & '\DirCopy.exe F:\Test C:\Test', '', @SW_SHOW, $STDOUT_CHILD) Do $Code = StdoutRead($PID) If @error Then ExitLoop EndIf Sleep(10) Until $Code = 'OK' GUISetCursor(2, 0, $hWnd) SplashOff() If $Code = 'OK' Then ... Else ... EndIfCompile the following script to DirCopy.exe.If $CmdLine[0] < 2 Then Exit EndIf If DirCopy($CmdLine[1], $CmdLine[2], 1) Then ConsoleWrite("OK") EndIf My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... 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