Jonniemac315 Posted August 20, 2007 Share Posted August 20, 2007 Is there any way to have a file progress window show up while files are copying via a Autoit script. CODE$file = FileExists ("c:\program files\activecontrol\1.txt") If $file = 0 Then MsgBox (262208, "Active Control", "Active Control is currently out of date. Please click OK to download the newest version. Another window will apear when the download is complete.", 10) FileCopy ("\\10.0.0.2\Activecontrol\current\*.*", "C:\program files\activecontrol\", 9) ; While this is going I would like to see a file transfer box if possiable, or maybe an instalation window that says that it is installing and shows a status bar on the percent completed. MsgBox (262208, "Completed", "Active Control is up to date now please press OK") Else $datew = FileGetTime ("c:\program files\activecontrol\1.txt", 0) $datesrvr = FileGetTime ("\\10.0.0.2\activecontrol\current\1.txt", 0) $WMMDDYYYY = $datew[1] & $datew[2] & $datew[0] & $datew[3] & $datew[4] $SMMDDYYYY = $datesrvr[1] & $datesrvr[2] & $datesrvr[0] & $datesrvr[3] & $datesrvr[4] if $WMMDDYYYY < $SMMDDYYYY Then MsgBox (262208, "Active Control", "Active Control is currently out of date. Please click OK to download the newest version. Another window will apear when the download is complete.", 10) FileCopy ("\\10.0.0.2\Activecontrol\current\*.*", "C:\program files\activecontrol\", 9) ; While this is going I would like to see a file transfer box if possiable, or maybe an instalation window that says that it is installing and shows a status bar on the percent completed. MsgBox (262208, "Completed", "Active Control is now up to date, please press OK") Else Exit EndIf EndIf Link to comment Share on other sites More sharing options...
Zedna Posted August 20, 2007 Share Posted August 20, 2007 Look here Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Jonniemac315 Posted August 20, 2007 Author Share Posted August 20, 2007 Look here_FileCopy("\\10.0.0.2\Activecontrol\current\*.*", "C:\program files\activecontrol\")Func _FileCopy($fromFile,$tofile) Local $FOF_RESPOND_YES = 16 Local $FOF_SIMPLEPROGRESS = 256 $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES)EndFuncI tired to use this for my code but it didn't suppress the propting for each file. I would like it to not ask the user to overwrite it would just do it. Any help would be greatly appreciated.Thanks,Jon Link to comment Share on other sites More sharing options...
JohnBailey Posted August 20, 2007 Share Posted August 20, 2007 Couldn't you just use a controlClick ? A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted August 20, 2007 Share Posted August 20, 2007 If not this might work http://msdn2.microsoft.com/en-us/library/ms649285.aspx A decision is a powerful thing Link to comment Share on other sites More sharing options...
Zedna Posted August 20, 2007 Share Posted August 20, 2007 (edited) _FileCopy("\\10.0.0.2\Activecontrol\current\*.*", "C:\program files\activecontrol\")Func _FileCopy($fromFile,$tofile) Local $FOF_RESPOND_YES = 16 Local $FOF_SIMPLEPROGRESS = 256 $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES)EndFuncI tired to use this for my code but it didn't suppress the propting for each file. I would like it to not ask the user to overwrite it would just do it. Any help would be greatly appreciated.Thanks,JonYou can use more flags:;~ 4 Do not display a progress dialog box. ;~ 8 Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists. ;~ 16 Respond with "Yes to All" for any dialog box that is displayed. ;~ 64 Preserve undo information, if possible. ;~ 128 Perform the operation on files only if a wildcard file name (*.*) is specified. ;~ 256 Display a progress dialog box but do not show the file names. ;~ 512 Do not confirm the creation of a new directory if the operation requires one to be created. ;~ 1024 Do not display a user interface if an error occurs. ;~ 2048 Version 4.71. Do not copy the security attributes of the file. ;~ 4096 Only operate in the local directory. Don't operate recursively into subdirectories. ;~ 9182 Version 5.0. Do not copy connected files as a group. Only copy the specified files. Edited August 20, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JohnBailey Posted August 20, 2007 Share Posted August 20, 2007 (edited) Jonniemac315, I just tested the script you posted (#390901) and what is the problem?I doesn't ask me anything.Spoke too soon. It does not select Yes To All. Zedna, what are you saying? Are you saying it should work?According to http://msdn2.microsoft.com/en-us/library/ms630707.aspx, 16 should work... odd. Why isn't it working? Edited August 20, 2007 by JohnBailey A decision is a powerful thing Link to comment Share on other sites More sharing options...
Jonniemac315 Posted August 22, 2007 Author Share Posted August 22, 2007 Jonniemac315, I just tested the script you posted (#390901) and what is the problem?I doesn't ask me anything.Spoke too soon. It does not select Yes To All. Zedna, what are you saying? Are you saying it should work?According to http://msdn2.microsoft.com/en-us/library/ms630707.aspx, 16 should work... odd. Why isn't it working?Maybe I have the 16 in the wrong spot. Is this where it is supposed to go? $winShell.namespace($tofile).CopyHere($fromFile,16) Link to comment Share on other sites More sharing options...
JohnBailey Posted August 22, 2007 Share Posted August 22, 2007 Maybe I have the 16 in the wrong spot. Is this where it is supposed to go? $winShell.namespace($tofile).CopyHere($fromFile,16)According to MSDN, it's in the correct spot. A decision is a powerful thing Link to comment Share on other sites More sharing options...
Jonniemac315 Posted August 27, 2007 Author Share Posted August 27, 2007 According to MSDN, it's in the correct spot.Figured it out you can't use a wild card for the FromFile After I just put in a single file it worked great.Thanks for all the help. Link to comment Share on other sites More sharing options...
Jonniemac315 Posted August 27, 2007 Author Share Posted August 27, 2007 expandcollapse popup_FileCopy1("\\10.0.0.2\Activecontrol\current\1.txt", "C:\program files\activecontrol\") _FileCopy2("\\10.0.0.2\Activecontrol\current\ActiveControl.mdb", "C:\program files\activecontrol\") _FileCopy3("\\10.0.0.2\Activecontrol\current\Control.ico", "C:\program files\activecontrol\") _FileCopy4("\\10.0.0.2\Activecontrol\current\Security.mdw", "C:\program files\activecontrol\") $file = FileExists ("c:\program files\activecontrol\1.txt") If $file = 0 Then MsgBox (262208, "Active Control", "Active Control is currently out of date. Please click OK to download the newest version. Another window will apear when the download is complete.", 10) Func _FileCopy1($fromFile,$tofile) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,272) EndFunc Func _FileCopy2($fromFile,$tofile) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,272) EndFunc Func _FileCopy3($fromFile,$tofile) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,272) EndFunc Func _FileCopy4($fromFile,$tofile) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,272) EndFunc MsgBox (262208, "Completed", "Active Control is up to date now please press OK") Else $datew = FileGetTime ("c:\program files\activecontrol\1.txt", 0) $datesrvr = FileGetTime ("\\10.0.0.2\activecontrol\current\1.txt", 0) $WMMDDYYYY = $datew[1] & $datew[2] & $datew[0] & $datew[3] & $datew[4] $SMMDDYYYY = $datesrvr[1] & $datesrvr[2] & $datesrvr[0] & $datesrvr[3] & $datesrvr[4] If $WMMDDYYYY < $SMMDDYYYY Then MsgBox (262208, "Active Control", "Active Control is currently out of date. Please click OK to download the newest version. Another window will apear when the download is complete.", 10) Func _FileCopy1($fromFile,$tofile) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,272) EndFunc Func _FileCopy2($fromFile,$tofile) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,272) EndFunc Func _FileCopy3($fromFile,$tofile) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,272) EndFunc Func _FileCopy4($fromFile,$tofile) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,272) EndFunc MsgBox (262208, "Completed", "Active Control is now up to date, please press OK") Else Exit EndIf EndIfFigured it out you can't use a wild card for the FromFile After I just put in a single file it worked great. Thanks for all the help. Okay it worked by its self but once I put it into the code it broke my code please help Link to comment Share on other sites More sharing options...
JohnBailey Posted August 27, 2007 Share Posted August 27, 2007 Figured it out you can't use a wild card for the FromFile After I just put in a single file it worked great.Thanks for all the help.oh wow so that's the solution! Interesting that it wasn't noted (at least what I could tell). It's also interesting that it has to be that way. A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted August 27, 2007 Share Posted August 27, 2007 it broke my codeWhat do you mean by that? A decision is a powerful thing Link to comment Share on other sites More sharing options...
Jonniemac315 Posted August 27, 2007 Author Share Posted August 27, 2007 What do you mean by that?I get the error C:\Documents and Settings\VPCAdmin.RAMMINC\Desktop\update.au3 (9) : ==> "If" statement has no matching "EndIf" statement.: Link to comment Share on other sites More sharing options...
Jonniemac315 Posted August 27, 2007 Author Share Posted August 27, 2007 I get the error C:\Documents and Settings\VPCAdmin.RAMMINC\Desktop\update.au3 (9) : ==> "If" statement has no matching "EndIf" statement.:>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\VPCAdmin.RAMMINC\Desktop\update.au3" C:\Documents and Settings\VPCAdmin.RAMMINC\Desktop\update.au3 (9) : ==> "If" statement has no matching "EndIf" statement.: Func _FileCopy1($fromFile,$tofile) >Exit code: 1 Time: 0.217Opps forgot some stuff. Link to comment Share on other sites More sharing options...
JohnBailey Posted August 27, 2007 Share Posted August 27, 2007 >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\VPCAdmin.RAMMINC\Desktop\update.au3" C:\Documents and Settings\VPCAdmin.RAMMINC\Desktop\update.au3 (9) : ==> "If" statement has no matching "EndIf" statement.: Func _FileCopy1($fromFile,$tofile) >Exit code: 1 Time: 0.217Opps forgot some stuff.Why are you putting Funcs inside an if statement.... I'm totally sure on this with AU3, but I know in other languages you can't do that because they are defined first regardless of their location. A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted August 27, 2007 Share Posted August 27, 2007 essentially, you should even be able to do what you've done... at least that's my understanding. Just rename your functions to have 8 total and reference them in your script. A decision is a powerful thing Link to comment Share on other sites More sharing options...
Jonniemac315 Posted August 27, 2007 Author Share Posted August 27, 2007 essentially, you should even be able to do what you've done... at least that's my understanding. Just rename your functions to have 8 total and reference them in your script.I'm not sure what you are saying to do is there any way that you could show me just one so I can learn that.Thanks in advance. Link to comment Share on other sites More sharing options...
JohnBailey Posted August 27, 2007 Share Posted August 27, 2007 Some SuggestionsFirst of all, function need to be separate from your "process" (see example below). Second of all, if you have near similar functions that do nearly the same thing but have a small variant, use parameters - this will simplify your script. If you don't know (and you might), parameters are the vars in the function's parenthesis. I'm not totally sure what you're wanting to do, but this should at least show you what you might want to be doing. Putting functions in the process doesn't matter (except for generating bugs), because the functions are defined before the process runs and then are later called. That is why I'm able to put the function at the bottom. I'm sorry if you know all of this and I'm just "preaching to the choir.Local $file = FileExists ("c:\program files\activecontrol\1.txt") If $file = 0 Then MsgBox (262208, "Active Control", "Active Control is currently out of date. Please click OK to download the newest version. Another window will apear when the download is complete.", 10) _FileCopy("\\10.0.0.2\Activecontrol\current\1.txt", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\ActiveControl.mdb", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\Control.ico", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\Security.mdw", "C:\program files\activecontrol\") MsgBox (262208, "Completed", "Active Control is up to date now please press OK") Else $datew = FileGetTime ("c:\program files\activecontrol\1.txt", 0) $datesrvr = FileGetTime ("\\10.0.0.2\activecontrol\current\1.txt", 0) $WMMDDYYYY = $datew[1] & $datew[2] & $datew[0] & $datew[3] & $datew[4] $SMMDDYYYY = $datesrvr[1] & $datesrvr[2] & $datesrvr[0] & $datesrvr[3] & $datesrvr[4] If $WMMDDYYYY < $SMMDDYYYY Then MsgBox (262208, "Active Control", "Active Control is currently out of date. Please click OK to download the newest version. Another window will apear when the download is complete.", 10) _FileCopy("\\10.0.0.2\Activecontrol\current\1.txt", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\ActiveControl.mdb", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\Control.ico", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\Security.mdw", "C:\program files\activecontrol\") MsgBox (262208, "Completed", "Active Control is now up to date, please press OK") Else Exit EndIf EndIf Func _FileCopy($fromFile,$tofile, $fc_flag=272) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,$fc_flag) EndFunc A decision is a powerful thing Link to comment Share on other sites More sharing options...
Jonniemac315 Posted August 28, 2007 Author Share Posted August 28, 2007 Some Suggestions First of all, function need to be separate from your "process" (see example below). Second of all, if you have near similar functions that do nearly the same thing but have a small variant, use parameters - this will simplify your script. If you don't know (and you might), parameters are the vars in the function's parenthesis. I'm not totally sure what you're wanting to do, but this should at least show you what you might want to be doing. Putting functions in the process doesn't matter (except for generating bugs), because the functions are defined before the process runs and then are later called. That is why I'm able to put the function at the bottom. I'm sorry if you know all of this and I'm just "preaching to the choir. Local $file = FileExists ("c:\program files\activecontrol\1.txt") If $file = 0 Then MsgBox (262208, "Active Control", "Active Control is currently out of date. Please click OK to download the newest version. Another window will apear when the download is complete.", 10) _FileCopy("\\10.0.0.2\Activecontrol\current\1.txt", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\ActiveControl.mdb", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\Control.ico", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\Security.mdw", "C:\program files\activecontrol\") MsgBox (262208, "Completed", "Active Control is up to date now please press OK") Else $datew = FileGetTime ("c:\program files\activecontrol\1.txt", 0) $datesrvr = FileGetTime ("\\10.0.0.2\activecontrol\current\1.txt", 0) $WMMDDYYYY = $datew[1] & $datew[2] & $datew[0] & $datew[3] & $datew[4] $SMMDDYYYY = $datesrvr[1] & $datesrvr[2] & $datesrvr[0] & $datesrvr[3] & $datesrvr[4] If $WMMDDYYYY < $SMMDDYYYY Then MsgBox (262208, "Active Control", "Active Control is currently out of date. Please click OK to download the newest version. Another window will apear when the download is complete.", 10) _FileCopy("\\10.0.0.2\Activecontrol\current\1.txt", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\ActiveControl.mdb", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\Control.ico", "C:\program files\activecontrol\") _FileCopy("\\10.0.0.2\Activecontrol\current\Security.mdw", "C:\program files\activecontrol\") MsgBox (262208, "Completed", "Active Control is now up to date, please press OK") Else Exit EndIf EndIf Func _FileCopy($fromFile,$tofile, $fc_flag=272) $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,$fc_flag) EndFunc Nope don't know any of this I have just started writing code about a month ago so everything that gets posted here is a big help. Thanks alot, Jon 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