Michael_Gerrard Posted September 21, 2004 Share Posted September 21, 2004 I would like to copy some files using DirCopy(). While doing this I'd like to have a progress bar. I've written the script to do this but unfortunately my AdlibEnable() doesn't seem to jump to my function and therefore my progress bar stays still Here's my code: ProgressOn("Windows XP Service Pack 2", "", "Copying setup files to the LAN - please wait...") $bar = 1 ProgressSet($bar) BlockInput(1) ;disable user input AdlibEnable("UpdateProgressBar", 1000) FileCopy("wxpsp2\sp2.exe", "F:\Public") DirCopy("wxpsp2", "F:\Public\wxpsp2", 1) ;copy and overwrite current files AdlibDisable() ProgressSet(100, "Finished.", "") SoundSetWaveVolume(100) SoundPlay("C:\Windows\Media\Notify.wav") Sleep(1000);pause or one second so the finished message can be read ProgressOff() BlockInput(0);enable user input MsgBox(0, "Windows XP Service Pack 2", "Finished." & @CR & @CR & "Go to each computer, click Start | Run, SP2 and press Enter") Exit ; Functions ; --------- Func UpdateProgressBar() $bar = $bar + 1 If $bar > 100 Then $bar = 0 Send("{UP}") ;press a key to stop the screen saver appearing EndIf ProgressSet($bar) EndFunc Any ideas? Thanks in advance Michael Link to comment Share on other sites More sharing options...
ZeDMIN Posted September 21, 2004 Share Posted September 21, 2004 (edited) REMOVED nevermind, i read it wrong. Greetings, ZeD Edited September 21, 2004 by ZeDMIN Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 21, 2004 Administrators Share Posted September 21, 2004 I would like to copy some files using DirCopy(). While doing this I'd like to have a progress bar. I've written the script to do this but unfortunately my AdlibEnable() doesn't seem to jump to my function and therefore my progress bar stays still Here's my code: ProgressOn("Windows XP Service Pack 2", "", "Copying setup files to the LAN - please wait...") $bar = 1 ProgressSet($bar) BlockInput(1) ;disable user input AdlibEnable("UpdateProgressBar", 1000) FileCopy("wxpsp2\sp2.exe", "F:\Public") DirCopy("wxpsp2", "F:\Public\wxpsp2", 1);copy and overwrite current files AdlibDisable() ProgressSet(100, "Finished.", "") SoundSetWaveVolume(100) SoundPlay("C:\Windows\Media\Notify.wav") Sleep(1000);pause or one second so the finished message can be read ProgressOff() BlockInput(0);enable user input MsgBox(0, "Windows XP Service Pack 2", "Finished." & @CR & @CR & "Go to each computer, click Start | Run, SP2 and press Enter") Exit ; Functions ; --------- Func UpdateProgressBar() $bar = $bar + 1 If $bar > 100 Then $bar = 0 Send("{UP}");press a key to stop the screen saver appearing EndIf ProgressSet($bar) EndFunc Any ideas? Thanks in advance The problem is that Adlib is only executed inbetween lines of the main script. So if the filecopy takes 20 seconds the adlib won't run until it's finished. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Michael_Gerrard Posted September 21, 2004 Author Share Posted September 21, 2004 While DirCopy is working nothing else can happen? Errrkkk!!! Looks like I've got to have a simple "Please wait" message :-( Michael Link to comment Share on other sites More sharing options...
SlimShady Posted September 21, 2004 Share Posted September 21, 2004 While DirCopy is working nothing else can happen? Errrkkk!!! Looks like I've got to have a simple "Please wait" message :-( <{POST_SNAPBACK}>Yes. The same with batch files. Link to comment Share on other sites More sharing options...
Michael_Gerrard Posted September 21, 2004 Author Share Posted September 21, 2004 Yes. The same with batch files. <{POST_SNAPBACK}>But with XCOPY you can see the files zooming by as they are being copied! I've posted a wish in the Idea Lab for some kind of activity indicator for FileCopy and DirCopy. I will keep my fingers crossed for the future... Michael Link to comment Share on other sites More sharing options...
Michael_Gerrard Posted September 21, 2004 Author Share Posted September 21, 2004 This IS a script language. You will need to Script the solution. Using FileFindFirstFile/FileFindNextFile to load the files into an array then copy them in a For Loop updating the progress as it goes. You can do it... I believe in you. Lar. <{POST_SNAPBACK}>That sounds interesting, one of these days maybe I'll try it. But I found an easier way of doing it. I have two scripts. Here's the main script: Run("Progress.exe") FileCopy("wxpsp2\sp2.exe", "F:\Public") DirCopy("wxpsp2", "F:\Public\wxpsp2", 1) ;copy and overwrite current files WinKill("Windows XP Service Pack 2") Here's the second script called Progress.exe. WinMinimizeAll() BlockInput(1) ProgressOn("Windows XP Service Pack 2", "", "Copying setup files to the LAN - please wait...") $bar = 1 ProgressSet($bar) While WinExists("Windows XP Service Pack 2", "Copying") Sleep(3000) ;pause to make the progress bar slower $bar = $bar + 1 If $bar > 100 Then $bar = 0 Send("{UP}");press a key to stop the screen saver appearing EndIf ProgressSet($bar) WEnd BlockInput(0) Exit The idea is that Progress.exe when run using Run() will continue executing even while the DirCopy is working in the original script. When I want Progress.exe to stop, I kill the window. The Progress.exe while/wend loop ends when it can't see the window anymore thereby closing the Progress.exe program. It works well enough. It seems a bit slow though. But it's not bad. Michael Michael 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