Cryptor Posted July 22, 2006 Share Posted July 22, 2006 (edited) Hi, i will download a file with wget. I will rename the file in my autoit script. I can´t! Please help! :"> Download the newest file bla32*.exe Rename the file bla32.*date*.exe to bla32.exe Run the file bla32.exe RunWait(@ComSpec & " /c " & 'wget.exe -P %snapshotpath% ftp://ftp......../bla32*.exe', "",) Run(@ComSpec & " /c" & '%snapshotpath%bla32.exe',"", @SW_HIDE) DOS Code wget.exe ftp://ftp......../bla32*.exe ren bla32*.exe bla32.exe start bla32.exe Edited July 22, 2006 by Cryptor Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 22, 2006 Share Posted July 22, 2006 Hi, have a look at FileMove. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 22, 2006 Share Posted July 22, 2006 (edited) Hi, i will download a file with wget. I will rename the file in my autoit script. I can´t! Please help! :"> Download the newest file bla32*.exe Rename the file bla32.*date*.exe to bla32.exe Run the file bla32.exe RunWait(@ComSpec & " /c " & 'wget.exe -P %snapshotpath% ftp://ftp......../bla32*.exe', "",) Run(@ComSpec & " /c" & '%snapshotpath%bla32.exe',"", @SW_HIDE) DOS Code wget.exe ftp://ftp......../bla32*.exe ren bla32*.exe bla32.exe start bla32.exe So... the files have some kind of date/time stamp formatted into the file name? Your DOS code assumes that the files will be renamed by REN in sorted file name order, which I wouldn't count on being consistent, and I think in most environments renaming multiple files to a single file name would be considered a broken function. (Lots of things are broken and funky in DOS/CMD shell). It would be easy to find the file with latest date/time stamp using FileFindFirstFile() and FileFindNextFile(). If you don't see how, just post a couple of examples of the filename formatting. P.S. @th.meger: FileMove() will take a wildcard for source and destination, but won't it generate an error if there is a wildcard in the source but not in the destination? I've never tried it, and don't have a Windows box to ttest it on. Edited July 22, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 22, 2006 Share Posted July 22, 2006 P.S. @th.meger: FileMove() will take a wildcard for source and destination, but won't it generate an error if there is a wildcard in the source but not in the destination? I've never tried it, and don't have a Windows box to ttest it on. Hi,no won't error out. No problem there. So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Cryptor Posted July 23, 2006 Author Share Posted July 23, 2006 I can´t! Please help! Here is the script. Test it please and help me to rename the downloaded file after download in the %snapshotpath%. Attachment File with the .au3 Script & wget.exe expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) AutoItSetOption("TrayIconHide", 1) GuiCreate("Download NOD32 Antivirus", 330, 220) GuiSetIcon("nod.ico") GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUICtrlCreateGroup ("Proxy server ", 10, 10, 310, 90) $PROXYID = GUICtrlCreateCheckbox("Use a proxy server for your LAN connection", 30, 30, 235, 20) GUICtrlSetOnEvent($PROXYID,"OnProxy") GUICtrlCreateLabel("Address:", 50, 62, 50, 20) GUICtrlSetState(-1,$GUI_DISABLE) $ipaddy=GUICtrlCreateInput("", 100, 60, 95, 20) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlCreateLabel("Port:", 220, 62, 30, 20) GUICtrlSetState(-1,$GUI_DISABLE) $port=GUICtrlCreateInput("", 250, 60, 40, 20) GUICtrlSetState(-1,$GUI_DISABLE) $useproxy ="no" GUICtrlCreateGroup ("",-99,-99,1,1) ;close group GUICtrlCreateGroup ("Download and launch from ", 10, 110, 310, 70) GUICtrlCreateLabel("Location:", 30, 142, 50, 20) $save=GUICtrlCreateInput("B:\", 85, 140, 205, 20) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group GUICtrlCreateLabel("v0.1 - ©2006 by Cryptor", 10, 200, 120, 20) $OKID = GuiCtrlCreateButton("OK", 160, 190, 75, 23) GUICtrlSetOnEvent($OKID,"OnOK") $CANCELID = GuiCtrlCreateButton("Cancel", 245, 190, 75, 23) GUICtrlSetOnEvent($CANCELID,"OnCANCEL") GUISetState () While 1 Wend ;--------------- Functions --------------- Func OnProxy() If GUICtrlRead($PROXYID) = "1" then GUICtrlCreateLabel("Address:", 50, 62, 50, 20) $ipaddy=GUICtrlCreateInput("", 100, 60, 95, 20) GUICtrlCreateLabel("Port:", 220, 62, 30, 20) $port=GUICtrlCreateInput("", 250, 60, 40, 20) $useproxy ="yes" ElseIF GUICtrlRead($PROXYID) = "4" then $ipaddy="" $port="" GUICtrlCreateLabel("Address:", 50, 62, 50, 20) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlCreateInput("", 100, 60, 95, 20) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlCreateLabel("Port:", 220, 62, 30, 20) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlCreateInput("", 250, 60, 40, 20) GUICtrlSetState(-1,$GUI_DISABLE) $useproxy ="no" EndIf EndFunc Func OnOK() If $useproxy = "no" Then $location = GUICtrlRead($save) envset ("snapshotpath", $location) Else $location = GUICtrlRead($save) $paddress = GUICtrlRead($ipaddy) $pport = GUICtrlRead($port) $ipaddyport = $paddress & ":" & $pport envset ("http_proxy", $ipaddyport) envset ("ftp_proxy", $ipaddyport) envset ("snapshotpath", $location) EndIf GUIDelete() RunWait(@ComSpec & " /c " & 'wget.exe -P %snapshotpath% ftp://ftp.isu.edu.tw/pub/Windows/Edskes/n/nod32*.exe', "",) Run(@ComSpec & " /c" & '%snapshotpath%nod32.exe',"", @SW_HIDE) Exit EndFunc Exit Func OnCANCEL() Exit EndFunc Func SpecialEvents() If @GUI_CTRLID = $GUI_EVENT_CLOSE Then Exit EndFunc Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 23, 2006 Share Posted July 23, 2006 Hi, you can just use something like this to download and name your file as wished. #include <file.au3> InetGet('ftp://ftp.isu.edu.tw/pub/Windows/Edskes/n/00_index.txt', @TempDir &'\index.txt', 1,0) Dim $aRecords If Not _FileReadToArray(@TempDir & '\index.txt', $aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] If StringInStr($aRecords[$x], 'nod') <> 0 Then Local $exe =_StringBetween1($aRecords[$x], 0 , ' ') EndIf Next InetGet('ftp://ftp.isu.edu.tw/pub/Windows/Edskes/n/' & $exe, @ScriptDir & '\nod32.exe', 1) Func _StringBetween1($s_String, $s_Start = 0, $s_End = 0) $s_Start = StringInStr($s_String, $s_Start) + StringLen($s_Start) Return StringMid($s_String, $s_Start, StringInStr($s_String, $s_End) - $s_Start) EndFunc ;==>_StringBetween1 So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 23, 2006 Share Posted July 23, 2006 Hi, you Pmed me. But I didn't see your problem? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Cryptor Posted July 23, 2006 Author Share Posted July 23, 2006 Hi,you Pmed me. But I didn't see your problem? So long,MegaI become a error after run the script from you.can you edit my script with your entries? 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