Jump to content

SplashText hung


Cyri
 Share

Recommended Posts

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

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

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

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

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

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

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

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

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

Compile the following script to DirCopy.exe.

If $CmdLine[0] < 2 Then
    Exit
EndIf
If DirCopy($CmdLine[1], $CmdLine[2], 1) Then
    ConsoleWrite("OK")
EndIf
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...