Jump to content

Search the Community

Showing results for tags 'While loop'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • Forum FAQ
  • AutoIt


  • Community Calendar

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 6 results

  1. Hi guys! I need some help here, is there a way to use Random with While? I need this script to run in between 1 and 4 times but I dont know how to do it, can you please help me? dim $i=1 While $i<=4 Sleep(3000) Send("{LWINDOWN}r{LWINUP}") Sleep(3000) Send("C:\Users\123\Catalogos\tags.txt{ENTER}") Sleep(3000) WinActivate("tags: Bloc de notas","") Sleep(3000) Send("{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{DEL}{DEL}") Sleep(3000) Send("{CTRLDOWN}g{CTRLUP}{ALTDOWN}{F4}{ALTUP}") Sleep(3000) Send("{CTRLDOWN}v{CTRLUP}{SPACE}") $i=$i+1 WEnd
  2. Afternoon! This is my first post, so I apologize if this is in the wrong place. I've created a while loop to click in a certain area of an application, and have the y axis change at the end of each loop. My loop continues to click at x:27, x:10, even though the $y is adding 15 at the end of each loop. I did a Send($x) and Send($y) into a Notepad to see if the $y had changed after each loop, and the 15 was being added to $y each loop. (If this makes sense) I'm unsure where I'm going wrong, and would be extremely grateful if someone can point me in the correct direction to fix this. Local $rDirectory = "H:\oDemandProject\fList.txt" Local $rLine = _FileCountLines($rDirectory) Local $x = 27 Local $y = 10 While $rline > 0 WinActivate("OnDemand", "-> 1") WinWaitActive("OnDemand", "-> 1") ControlClick("OnDemand", "", "[CLASS:AfxFrameOrView120u; INSTANCE:1]", "left", 4, $x, $y) $y += 15 $rLine -= 1 WEnd
  3. hi, i am new to autoit. i prepared the attached code which will replace particular values in the file. the program works well in the first pass, but the while loop is not working in the second go. could anyone look into the attached code. If the ';#' in the code are replaced with '#', then the program works well. sacs-read.au3 GMS Det Leg.txt
  4. Hi All, I am developing an IRC Bot and have come across a small problem. Everything works fine until the ConnectToIRC function is called. This is when a while Loop is in play, I assume this is because the while loop is hogging the program and blocking other commands. so my question, Is there a way around this or a way I could do this differently so that I can receive data when it comes in and also use controls on the gui? If I remove the while loop inside the ConnectToIRC function, Other gui buttons work correctly (Close Button for example) Thanks for any help or insight you may provide. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GUIEdit.au3> #Include <ScrollBarConstants.au3> #include <ComboConstants.au3> #Include <Array.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("AutoIT IRCBot", 537, 339, 192, 124) $Edit1 = GUICtrlCreateEdit("", 8, 8, 521, 257, $ES_AUTOVSCROLL + $WS_VSCROLL) $btnSend = GUICtrlCreateButton("Send", 456, 304, 73, 25) $inIRCServ = GUICtrlCreateInput("irc.freenode.net", 8, 272, 97, 21) $inPort = GUICtrlCreateInput("6667", 112, 272, 65, 21) $inChat = GUICtrlCreateInput("", 288, 304, 161, 21) $btnCon = GUICtrlCreateButton("Connect", 184, 272, 73, 25) $Combo1 = GUICtrlCreateCombo("Channel", 288, 272, 161, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseBot") GUICtrlSetOnEvent($btnCon, "ConnectToIRC") GUICtrlSetOnEvent($btnSend, "IRCSend") GUISetState(@SW_SHOW) TCPStartup() ;~ Read INI Values Global $vIRCNick = IniRead("ircbot.ini", "information", "Nick", "AutoITIRCBot") Global $vIRCAltNick = IniRead("ircbot.ini", "information", "AltNick", "AutoITIRCBot_") Global $vIRCRealName = IniRead("ircbot.ini", "information", "RealName", "AutoITIRCBot") Global $vIRCChannels = IniRead("ircbot.ini", "information", "Channels", "#AutoITIRCBot") $vChanArr = StringSplit($vIRCChannels, "|") While 1 Sleep(100) WEnd Func ConnectToIRC() GUICtrlSetState($btnCon, $GUI_DISABLE) GUICtrlSetState($inIRCServ, $GUI_DISABLE) GUICtrlSetState($inPort, $GUI_DISABLE) $vIRCServer = TCPNameToIP(GuiCtrlRead($inIRCServ)) $vIRCPort = GuiCtrlRead($inPort) $vConnect = TCPConnect($vIRCServer, $vIRCPort) TCPSend($vConnect, "USER " & $vIRCNick & " 0 0 :" & $vIRCRealName & @CRLF) TCPSend($vConnect, "NICK " & $vIRCNick & @CRLF) For $i = 1 to Ubound($vChanArr) -1 TCPSend($vConnect, "JOIN " & $vChanArr[$i] & @CRLF) GUICtrlSetData($Combo1, $vChanArr[$i], $vChanArr[$i]) Next While 1 $vRecv = TCPRecv($vConnect, 4096) If $vRecv <> "" Then GuiCtrlSetData($Edit1, $vRecv, 1) EndIf Wend EndFunc Func CloseBot() Exit EndFunc Ini File [information] Nick=UKTestBot AltNick=UKTestBot_ RealName=UKTestBOT Channels=#test333|#test222
  5. Hello everyone, Have a tricky question: How i manage to exit from loop, but not from script? (ExitLoop it is ok, but runned out of ways, how to use it in my script ) With this i have a problem: If i unpause (F2) the script, it will continue the loop. While scrip is paused (F2) i can restart it (F1), but: While script is paused (F2), and i open my form (F3), and try to press button on it, it will not work, cause active loop is paused at background. (I hope i understand right the method) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{F1}", "RunScript") HotKeySet("{F2}", "Pause") HotKeySet("{F3}", "OpenForm") Global $Pause $GUI_Create_Form = GUICreate("Settings", 175, 95) $Button_Save = GUICtrlCreateButton("Save", 10, 60, 75, 25) $Button_Cancel = GUICtrlCreateButton("Cancel", 90, 60, 75, 25) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button_Save MsgBox(0, "Notification", "Settings have been saved!", 1) GUISetState(@SW_HIDE) Case $Button_Cancel GUISetState(@SW_HIDE) EndSwitch WEnd Func RunScript() Local $Numbers = 1 While 1 $Numbers = $Numbers + 1 Sleep(250) ToolTip("Numbers:" & $Numbers, 0, 0) WEnd EndFunc ;==>RunScript Func Pause() $Pause = Not $Pause While $Pause Sleep(100) ToolTip('Scrpit is "Paused"', 0, 0) WEnd ToolTip("", 0, 0) EndFunc ;==>Pause Func OpenForm() GUISetState() EndFunc ;==>OpenForm All i want is, brake the counter loop with hotkey. Can anyone help me to give a logical answare? (I do need the form with buttons, to store data / save settings)
  6. I've been using AutoIt for about the past two weeks. The code I've created is supposed to open an excel file, combine the first two columns of information into a third column. Then take that new information from the third column and input it into a url. Finally, it saves the file as a .csv and closes it. This code is going to be run everyday at the end of the day and that's where my problem starts. Currently, I've got a code that works but I've got a For loop right now that has defined parameters and I think what I really want is a While loop. The number of rows that will exist in the excel file will change on a daily basis, and that's why I think I need a While loop so I can tell it to continue combining the information from the first two columns until the rows stop. I've tried searching this forum and the rest of the internet for an answer to my problem and all I've found are examples closer to mine from 2007 or 2008. Unfortunately, they mention a function called "_ExcelSheetUsedRangeGet" which when inputted into AutoIt gives me an error about the function not existing. I also can't find the function in a help file, so I don't know where to go from here. And I tried reading up on the post titled "Yet Another -- ExcelCOM UDF" but that didn't help me either. Any and all help would be greatly appreciated. Here's my code that's working with the For loop: ; *************************************************************** ; This should open an excel file with "NameCurrentDate." ; The excel file starts with two columns, "HobsonsID" and "TourDate" ; This creates a third column called "URL Code" that is a combination of Column 1 and 2 ; Then it creates a fourth column called "URL" ; This column contains the URL to the QR Code with the personalized information ; Then it saves the file as a .csv. ; ***************************************************************** #include <Excel.au3> $today = @MON & "." & @MDAY & "." & @YEAR; $sFilePath1 = @ScriptDir & "\TourRecon" & $today & ".xlsx" ;This file should already exist $oExcel = _ExcelBookOpen($sFilePath1) If @error = 1 Then MsgBox(0, "Error!", "Unable to Create the Excel Object") Exit ElseIf @error = 2 Then MsgBox(0, "Error!", "File does not exist - Shame on you! The path you gave me is" & $sFilePath1) Exit EndIf _ExcelWriteCell($oExcel, "URL Code", 1, 3) ;Puts the Column header "URL Code" in the first row, Column 3 For $i = 2 To 8 ;Loop _ExcelWriteCell($oExcel, "=A" & $i & "&-B" & $i, $i, 3) ;Combines Column 1 and Column 2, puts output in Column 3 Next _ExcelWriteCell($oExcel, "URL", 1, 4) ;Puts the Column header "URL" in the first row, Column 4 For $j = 2 To 8 ;Loop _ExcelWriteCell($oExcel, "=CONCATENATE(CONCATENATE(""http://admissions.calpoly.edu/"", C" & $j & "), "".html"")", $j, 4) ;Write to the Cell Next ;This puts a URL into Column 4, starting at Row 2 $sFilePath = @ScriptDir & "\TourRecon" & $today & ".csv"; $sType = "csv"; _ExcelBookSaveAs($oExcel, $sFilePath, $sType) If Not @error Then MsgBox(0, "Success", "File was Saved!", 3)
  • Create New...