Doppio Posted September 19, 2007 Share Posted September 19, 2007 Good Morning. I need to script the following ftp command ftp -A -s:ftpcmd.txt 192.168.1.5 content of the text file: bin get HEAT.iso bye the script has to run in a loop, I'm doing this bacause I'm running a stress test on my wireless network. Can anybody help me? Thanks. Link to comment Share on other sites More sharing options...
Doppio Posted September 19, 2007 Author Share Posted September 19, 2007 This is what I got so far using VBS. Dim i i = 0 for i = 0 to 30 Set objShell = CreateObject("WScript.Shell") document.Write(i) objShell.Run "c:\windows\system32\ftp.exe -A -s:ftpcmd.txt 10.99.146.94", , True Set objShell = Nothing next Can someone show me how to do it in autoscript? Thanks Link to comment Share on other sites More sharing options...
cdkid Posted September 19, 2007 Share Posted September 19, 2007 (edited) Or... you could just ..hmm... RTFM? Maybe see "FTP.au3" or the RUN function? Please search (1) the helpfile and (2) the forums before asking questions like this. Maybe post some autoit code showing your effort, and you could get more help edit: I'm sorry if this came off a bit harsh, it just seems that you didn't put much effort into it. Not trying to be mean, just a bit agitated today. ~cdkid Edited September 19, 2007 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Doppio Posted September 19, 2007 Author Share Posted September 19, 2007 Or... you could just ..hmm... RTFM? Maybe see "FTP.au3" or the RUN function?Please search (1) the helpfile and (2) the forums before asking questions like this. Maybe post some autoit code showing your effort, and you could get more helpedit:I'm sorry if this came off a bit harsh, it just seems that you didn't put much effort into it. Not trying to be mean, just a bit agitated today.~cdkidUnderstood.Just didn't have a lot of time this morning to search the forums, or the help file as this request came as a sorprice from my boss.as you can see I know how to do it from vbs, but like autoit better.Just a quick question for you:I'm trying to run a stress test on my wireless access point, that's why I'm generating traffic with this ftp command. What would you recommend, Is this a good way of stressing my AP?Thanks. Link to comment Share on other sites More sharing options...
Doppio Posted September 19, 2007 Author Share Posted September 19, 2007 After some research I finally came up with the following: ;Stree Test for AP InetGet("ftp://10.99.146.94/heat2.txt", "test.txt", 1, 1) While @InetGetActive TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16) Sleep(250) Wend MsgBox(0, "Bytes read", @InetGetBytesRead) I need help setting a loop, so that the file gets downloaded 30 times Thanks. Link to comment Share on other sites More sharing options...
Zedna Posted September 19, 2007 Share Posted September 19, 2007 ;Stree Test for AP Global $BytesTotal = 0 For $i = 1 To 30 InetGet("ftp://10.99.146.94/heat2.txt", "test.txt", 1, 1) While @InetGetActive TrayTip("Downloading " & $i & "/30", "Bytes = " & @InetGetBytesRead, 10, 16) Sleep(250) Wend $BytesTotal += @InetGetBytesRead Next MsgBox(0, "Bytes read", $BytesTotal) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
wolf9228 Posted September 19, 2007 Share Posted September 19, 2007 (edited) This is what I got so far using VBS. Dim i i = 0 for i = 0 to 30 Set objShell = CreateObject("WScript.Shell") document.Write(i) objShell.Run "c:\windows\system32\ftp.exe -A -s:ftpcmd.txt 10.99.146.94", , True Set objShell = Nothing next Can someone show me how to do it in autoscript? Thanks expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("MS-DOS_FTP", 419, 120, 127, 128) GUISetFont(10, 400, 0, "MS Sans Serif") GUISetBkColor(0xFFFFFF) $Input1 = GUICtrlCreateInput("autoitscript.com", 88, 16, 185, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("FTP Server", 8, 16, 73, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Input2 = GUICtrlCreateInput("autoit", 88, 48, 185, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel(" user ", 8, 48, 72, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Input3 = GUICtrlCreateInput("script", 88, 80, 185, 24,$ES_PASSWORD) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("password", 8, 80, 71, 28) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Button1 = GUICtrlCreateButton("sourceDir", 296, 8, 113, 33, 0) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Uploading", 296, 56, 113, 33, 0) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Checkbox1 = GUICtrlCreateCheckbox("@SW_HIDE", 296, 96, 113, 17) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetState($Button2, $GUI_DISABLE) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $var = FileSelectFolder("Choose a folder.", "") if $var <> "" then $ArrayToString = "" $List = _FileListToArray( $var, "*", 1) For $i = $List[0] to 1 Step -1 $ArrayToString = $ArrayToString & @CRLF & "put " & $List[$I] & " " & $List[$I] next $ArrayToString = $ArrayToString & @CRLF & "QUIT" GUICtrlSetState($Button2, $GUI_ENABLE) FileChangeDir (@ScriptDir) endif Case $Button2 $FTPServer = GUICtrlRead($Input1) $user = GUICtrlRead($Input2) $password = GUICtrlRead($Input3) $file = FileOpen($var & "\FTPX.DAT", 2) $command1 = "ftp -s:FTPX.DAT " & $FTPServer $command2 = $user & @CRLF & $password & @CRLF & $ArrayToString if FileWriteLine($file, $command2) then FileClose($file) FileChangeDir ($var) $commandX =@SW_MAXIMIZE IF BitAND (GUICtrlRead($Checkbox1), $GUI_CHECKED) then $commandX = @SW_HIDE RunWait($command1, "", $commandX) FileDelete("FTPX.DAT") FileChangeDir (@ScriptDir) endif EndSwitch WEnd Func _FileListToArray($sPath, $sFilter = "*", $iFlag = 0) Local $hSearch, $sFile, $asFileList[1] If Not FileExists($sPath) Then Return SetError(1, 1, "") If (StringInStr($sFilter, "\")) Or (StringInStr($sFilter, "/")) Or (StringInStr($sFilter, ":")) Or (StringInStr($sFilter, ">")) Or (StringInStr($sFilter, "<")) Or (StringInStr($sFilter, "|")) Or (StringStripWS($sFilter, 8) = "") Then Return SetError(2, 2, "") If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") $hSearch = FileFindFirstFile($sPath & "\" & $sFilter) If $hSearch = -1 Then Return SetError(4, 4, "") While 1 $sFile = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf If $iFlag = 1 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") <> 0 Then ContinueLoop If $iFlag = 2 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") = 0 Then ContinueLoop ReDim $asFileList[UBound($asFileList) + 1] $asFileList[0] = $asFileList[0] + 1 $asFileList[UBound($asFileList) - 1] = $sFile WEnd FileClose($hSearch) Return $asFileList EndFunc;==>_FileListToArray Edited September 19, 2007 by wolf9228 صرح السماء كان هنا Link to comment Share on other sites More sharing options...
Doppio Posted September 20, 2007 Author Share Posted September 20, 2007 Thanks everyone for the help. I'm finally hamering my Access Point and getting the results I wanted. 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