zackrspv Posted February 16, 2008 Share Posted February 16, 2008 (edited) Hello there, Here's a snippet: $movDir1 = IniRead("ini.ini", "EC", "ecdir", @ProgramFilesDir&"\Blah\Blah Blue\") $movDir = @ProgramFilesDir&$movDir1 $gomov = FileMove($fileName, $movDir&$fileName, 1) It reads the INI key just fine, so the last part '@ProgramFilesDir...' is not really needed, but is there just in case. However, when I try to execute this command it fails. When doing the debug, it can't copy. If the directory name was short: \windows\system32 for example it works, but if it is long \windows\system 32 here\ it fails. how can i get the command to move the file as requested? Edited March 31, 2008 by zackrspv -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
zackrspv Posted February 16, 2008 Author Share Posted February 16, 2008 Hello there, Here's a snippet: $movDir1 = IniRead("ini.ini", "EC", "ecdir", @ProgramFilesDir&"\Blah\Blah Blue\") $movDir = @ProgramFilesDir&$movDir1 $gomov = FileMove($fileName, $movDir&$fileName, 1) It reads the INI key just fine, so the last part '@ProgramFilesDir...' is not really needed, but is there just in case. However, when I try to execute this command it fails. When doing the debug, it can't copy. If the directory name was short: \windows\system32 for example it works, but if it is long \windows\system 32 here\ it fails. how can i get the command to move the file as requested? I decided to post the entire script. I'M VERY NEW, so stop the flaming before you even ignite it. Any helpful information, however, would be appreciated. Thanks! expandcollapse popup#include <GUIConstants.au3> ; create main window $main = GUICreate("Fix Files", 385, 427, 193, 124) ; grab configuration file from server, if fail (server down), close window with error message $getini = InetGet("http://helpbt.com/down/dlls/ini.ini", "ini.ini", 1, 0) $IniSize = InetGetSize("http://helpbt.com/down/dlls/ini.ini") ProgressOn("Fetching Configuration...", "Grabbing configuration file from server...") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $IniSize ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName) Sleep(250) Wend ProgressOff() if $getini Then ; read ini file so as to fill out proper combo boxes $ec = IniRead("ini.ini", "EC", "ECKey", "NavTrade.dll") $rtm = IniRead("ini.ini", "RTM", "RTMKey", "tunnelThru.ini") $eta = IniRead("ini.ini", "ETA", "ETAKey", "optlib.dll") $win = IniRead("ini.ini", "Win", "WinKey", "MSINET.OCX") $misc = IniRead("ini.ini", "MISC", "MSKey", "Twunk_32.dll") Else MsgBox(0, "Failed to get INI", "Unable to get configuration file from server. " & @LF & "Please check your internet connection, or it continues, the server may be down.") Exit EndIf ; create group for status section $Status = GUICtrlCreateGroup("Status of Actions", 24, 200, 329, 161) GUICtrlCreateGroup("", -99, -99, 1, 1) ; create label to state what to do $Label4 = GUICtrlCreateLabel("Please select the DLL/OCX/File that is broken below.", 32, 8, 257, 17) ; create button so as to start the action ;$n2 = GUICtrlCreateButton("Fix It", 168, 168, 75, 25, 0) ; create combo box #1 -- EC $n1 = GUICtrlCreateCombo("Extreme Charts", 136, 40, 233, 25) guictrlsetdata($n1,$ec) ; create combo box #2 -- RTM $n3 = GUICtrlCreateCombo("RTM", 136, 72, 233, 25) guictrlsetdata($n3,$rtm) ; create combo box #3 -- Win $n4 = GUICtrlCreateCombo("Win", 136, 104, 233, 25) guictrlsetdata($n4,$win) ; create combo box #4 -- Win $n5 = GUICtrlCreateCombo("ETA", 136, 136, 233, 25) guictrlsetdata($n5,$eta) ; create combo box #5 -- MISC $n6 = GUICtrlCreateCombo("MISC", 136, 164, 233, 25) guictrlsetdata($n6,$misc) ; create lables for combo boxes $Label323 = GUICtrlCreateLabel("Miscellaneous", 16, 164, 105, 17, $SS_RIGHT) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("Extreme Charts", 16, 40, 105, 17, $SS_RIGHT) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label6 = GUICtrlCreateLabel("Realtime Markets", 16, 72, 105, 17, $SS_RIGHT) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label7 = GUICtrlCreateLabel("Windows", 16, 104, 105, 17, $SS_RIGHT) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label8 = GUICtrlCreateLabel("Simutrade", 16, 136, 105, 17, $SS_RIGHT) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) ; create final instructions $Label1 = GUICtrlCreateLabel("Once all of the actions above are 'Done', the file you selected", 40, 368, 294, 17) $Label2 = GUICtrlCreateLabel("is fixed and you should be good to go. Simply Close this ", 56, 382, 270, 17) $Label3 = GUICtrlCreateLabel("application and delete it from the client's PC.", 82, 400, 212, 17) ; set the state of the window as show and activate the window GUISetState(@SW_SHOW) ; start with the actions ; first off, while the form is displayed, query the form every few mili seconds While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit case $n1 if GUIctrlRead($n1,1) = "Extreme Charts" then Else $FileURL = "http://www.helpbt.com/down/dlls/" & GUICtrlRead($n1, 1) $FileName = guictrlread($n1, 1) $FileSize = InetGetSize($FileURL) GUICtrlCreateLabel("Fetching: ", 32, 215, 85) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 98, 215, 195) guictrlsetfont(-1,9,600) InetGet($FileURL,$FileName,0,1) ProgressOn("","") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $FileSize ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName) Sleep(250) Wend ProgressOff() guictrlcreatelabel("Done", 196, 215, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) ; once file has been downloaded, decide where it is going to go. $movDir1 = IniRead("ini.ini", "EC", "ecdir", @ProgramFilesDir&"\Genesis\Navigator Suite\") $movDir = @ProgramFilesDir&$movDir1 ShellExecute("cmd", "/c ren "&$movDir&$fileName&"old."&random(3,39929)&$fileName) $gomov = FileMove($fileName, $movDir&$fileName, 1) if $gomov Then GUICtrlCreateLabel("Unset: ", 32, 229, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 98, 229, 195) guictrlsetfont(-1,9,600) $unreg = ShellExecuteWait("regsvr32.exe", "-u" & $movDir&$fileName & " /s") if $unreg Then guictrlcreatelabel("Done", 196, 229, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 196, 229, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to unregister the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf GUICtrlCreateLabel("Register: ", 32, 244, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 98, 244, 195) guictrlsetfont(-1,9,600) $regs = ShellExecuteWait("regsvr32.exe", $movDir&$fileName & " /s") if $regs Then guictrlcreatelabel("Done", 196, 244, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 196, 244, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to register the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf ;guictrlcreatelabel("Done", 175, 160, 75) ;guictrlsetcolor(-1,0x4A7023) ;guictrlsetfont(-1,10,600) Else MsgBox(0,"ERROR", "Unable to copy file over to system folder. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf EndIf case $n3 if GUIctrlRead($n3,1) = "RTM" then Else $FileURL = "http://www.helpbt.com/down/dlls/" & GUICtrlRead($n3, 1) $FileName = guictrlread($n3, 1) $FileSize = InetGetSize($FileURL) GUICtrlCreateLabel("Fetching: ", 10, 120, 85) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 120, 195) guictrlsetfont(-1,9,600) InetGet($FileURL,$FileName,0,1) ProgressOn("","") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $FileSize ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName) Sleep(250) Wend ProgressOff() guictrlcreatelabel("Done", 175, 120, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) ; once file has been downloaded, decide where it is going to go. $movDir1 = IniRead("ini.ini", "RTM", "rtmdir", @ProgramFilesDir&"\RealTimeMarkets\") $movDir = @ProgramFilesDir&$movDir1 $gomov = FileMove($fileName, $movDir&$fileName, 1) if $gomov Then GUICtrlCreateLabel("Unset: ", 10, 140, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 140, 195) guictrlsetfont(-1,9,600) $unreg = ShellExecuteWait("regsvr32.exe", "-u" & $movDir&$fileName & " /s") if $unreg Then guictrlcreatelabel("Done", 175, 140, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 175, 140, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to unregister the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf GUICtrlCreateLabel("Register: ", 10, 160, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 160, 195) guictrlsetfont(-1,9,600) $regs = ShellExecuteWait("regsvr32.exe", $movDir&$fileName & " /s") if $regs Then guictrlcreatelabel("Done", 175, 160, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 175, 160, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to register the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf guictrlcreatelabel("Done", 175, 160, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else MsgBox(0,"ERROR", "Unable to copy file over to system folder. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf EndIf case $n4 if GUIctrlRead($n4,1) = "Win" then Else $FileURL = "http://www.helpbt.com/down/dlls/" & GUICtrlRead($n4, 1) $FileName = guictrlread($n4, 1) $FileSize = InetGetSize($FileURL) GUICtrlCreateLabel("Fetching: ", 10, 120, 85) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 120, 195) guictrlsetfont(-1,9,600) InetGet($FileURL,$FileName,0,1) ProgressOn("","") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $FileSize ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName) Sleep(250) Wend ProgressOff() guictrlcreatelabel("Done", 175, 120, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) ; once file has been downloaded, decide where it is going to go. $movDir1 = IniRead("ini.ini", "Win", "winddir", @WindowsDir&"\system32\") $movDir = @WindowsDir&$movDir1 $gomov = FileMove($fileName, $movDir&$fileName, 1) if $gomov Then GUICtrlCreateLabel("Unset: ", 10, 140, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 140, 195) guictrlsetfont(-1,9,600) $unreg = ShellExecuteWait("regsvr32.exe", "-u" & $movDir&$fileName & " /s") if $unreg Then guictrlcreatelabel("Done", 175, 140, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 175, 140, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to unregister the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf GUICtrlCreateLabel("Register: ", 10, 160, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 160, 195) guictrlsetfont(-1,9,600) $regs = ShellExecuteWait("regsvr32.exe", $movDir&$fileName & " /s") if $regs Then guictrlcreatelabel("Done", 175, 160, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 175, 160, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to register the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf guictrlcreatelabel("Done", 175, 160, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else MsgBox(0,"ERROR", "Unable to copy file over to system folder. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf EndIf case $n5 if GUIctrlRead($n5,1) = "ETA" then Else $FileURL = "http://www.helpbt.com/down/dlls/" & GUICtrlRead($n5, 1) $FileName = guictrlread($n5, 1) $FileSize = InetGetSize($FileURL) GUICtrlCreateLabel("Fetching: ", 10, 120, 85) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 120, 195) guictrlsetfont(-1,9,600) InetGet($FileURL,$FileName,0,1) ProgressOn("","") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $FileSize ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName) Sleep(250) Wend ProgressOff() guictrlcreatelabel("Done", 175, 120, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) ; once file has been downloaded, decide where it is going to go. $movDir1 = IniRead("ini.ini", "ETA", "etadir", @ProgramFilesDir&"\Genesis\ETA\") $movDir = @ProgramFilesDir&$movDir1 $gomov = FileMove($fileName, $movDir&$fileName, 1) if $gomov Then GUICtrlCreateLabel("Unset: ", 10, 140, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 140, 195) guictrlsetfont(-1,9,600) $unreg = ShellExecuteWait("regsvr32.exe", "-u" & $movDir&$fileName & " /s") if $unreg Then guictrlcreatelabel("Done", 175, 140, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 175, 140, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to unregister the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf GUICtrlCreateLabel("Register: ", 10, 160, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 160, 195) guictrlsetfont(-1,9,600) $regs = ShellExecuteWait("regsvr32.exe", $movDir&$fileName & " /s") if $regs Then guictrlcreatelabel("Done", 175, 160, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 175, 160, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to register the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf guictrlcreatelabel("Done", 175, 160, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else MsgBox(0,"ERROR", "Unable to copy file over to system folder. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf EndIf case $n6 if GUIctrlRead($n6,1) = "MISC" then Else $FileURL = "http://www.helpbt.com/down/dlls/" & GUICtrlRead($n6, 1) $FileName = guictrlread($n6, 1) $FileSize = InetGetSize($FileURL) GUICtrlCreateLabel("Fetching: ", 10, 120, 85) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 120, 195) guictrlsetfont(-1,9,600) InetGet($FileURL,$FileName,0,1) ProgressOn("","") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $FileSize ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName) Sleep(250) Wend ProgressOff() guictrlcreatelabel("Done", 175, 120, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) ; once file has been downloaded, decide where it is going to go. $movDir1 = IniRead("ini.ini", "MISC", "miscdir", @WindowsDir&"\") $movDir = @WindowsDir&$movDir1 $gomov = FileMove($fileName, $movDir&$fileName, 1) if $gomov Then GUICtrlCreateLabel("Unset: ", 10, 140, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 140, 195) guictrlsetfont(-1,9,600) $unreg = ShellExecuteWait("regsvr32.exe", "-u" & $movDir&$fileName & " /s") if $unreg Then guictrlcreatelabel("Done", 175, 140, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 175, 140, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to unregister the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf GUICtrlCreateLabel("Register: ", 10, 160, 75) guictrlsetfont(-1,9,600) guictrlcreatelabel($fileName, 76, 160, 195) guictrlsetfont(-1,9,600) $regs = ShellExecuteWait("regsvr32.exe", $movDir&$fileName & " /s") if $regs Then guictrlcreatelabel("Done", 175, 160, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else guictrlcreatelabel("NOT DONE", 175, 160, 75) guictrlsetcolor(-1,0x000090) guictrlsetfont(-1,10,600) MsgBox(0,"ERROR", "Unable to register the file. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf guictrlcreatelabel("Done", 175, 160, 75) guictrlsetcolor(-1,0x4A7023) guictrlsetfont(-1,10,600) Else MsgBox(0,"ERROR", "Unable to copy file over to system folder. Restart the computer in safe mode and try again, or run this program as administrator!", 300) Exit EndIf EndIf EndSwitch WEnd -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
zackrspv Posted February 17, 2008 Author Share Posted February 17, 2008 It turned out that I had to set the attr's properly on the files before deleting/moving/copying them. SO i have changed the code some, and now it works. I would however, like to know how to make those into shared routines, or a function, to help cut down on size, any ideas? -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. 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