Jump to content

Search the Community

Showing results for tags 'loops'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

  • 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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 11 results

  1. Hi All, I want to make my progress bar progress with the amount of File lines read. How would I do this correctly. So far the code below can sometimes run in the middle of the progress bar and state completed.. and other times it can run into the 200%. ;======================================================================== ProgressOn("TITLE", "ACTION") ;======================================================================== For $count = 1 To _FileCountLines($FileRead) Step 1 $string = FileReadLine($FileRead, $count) $value1 = $input[1] $value2 = $input[2] $value3 = $input[3] $value4 = $input[4] $TM = FileWrite("C:\temp\test.txt", $value1 & " " & $value2 & " " & $value3 & " " & $value4 & @CRLF) ProgressSet($count, $count & "%") Next ;======================================================================== ; PROGRESS BAR OFF ;======================================================================== ProgressSet(_FileCountLines($FileRead), "Completed!") Sleep(750) ProgressOff() ;========================================================================
  2. Here is the script for the variable I want to find: Local $oSunHrsTD = _IETagNameGetCollection($oFrameobj, "span").item(138) The Item(138) for the span elemets is a dynamic number based on the index of all span objects on the webpage I am trying to send inputs to. Based on the span.item(#) the corresponding InnerText for that element is the value that I want to get. Which I use the following script: Local $oSunHrs = $oSunHrsTD.InnerText Global $otime = _IECreate ("https://somewebsite.banana") _IELoadWait($otime) Local $oFrameobj = _IEFrameGetObjByName($otime, "gsft_main") Local $oLinks = _IETagNameGetCollection($oFrameobj, "a") For $oLink In $oLinks If $oLink.ClassName = "linked formlink" Then _IEAction($oLink, "click") ExitLoop EndIf Next _IEloadWait($oFrameobj) Local $oMonHrsTD = _IETagNameGetCollection($oFrameobj, "span").item(139) Local $oMonHrs = $oMonHrsTD.InnerText _IELoadWait($oFrameobj) Local $oFrameobj = _IEFrameGetObjByName($otime, "gsft_main") Local $oMonHrs = _IETagNameGetCollection($oFrameobj, "SPAN") For $oMonHr In $oMonHrs If $oMonHr.ClassName = "aggregate_value" Then If $oMonHr.innertext >= "8" Then Local $oMonAdjHr = (8 - $oMonHR.Innertext) ConsoleWrite( $oMonHrs &@CRLF ) MsgBox (0, "Adjusted Value", $oMonAdjHr) ExitLoop EndIf EndIf Next Where I get confused is how I find Item(#) if all I have is the InnerText. Since the InnerText is static and the Item# is dynamic: $oSunHrsTD = _IETagNameGetCollection($oFrameobj, "span").item( "x").InnerText = ("sometext") How can i get the X value??
  3. $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 0 #include <MsgBoxConstants.au3> #Include <File.au3> Global $arlines WinActivate("MyApplication") ;Activate My Application Local $hWnd = WinWaitActive("MyApplication", "", 5) ;Wait for My Application for 5 seconds $oExcel.Application.WorkBooks.Open("C:\Users\Charlie\Desktop\Data.xlsx") ;Open Excel file 'Data.xlsx' local $iCell = $oExcel.Application.Cells(31,1).Value ;Read the value from cell A31 $file = @ScriptDir & "\Capture.log" If $hWnd Then For $a = 1 to $iCell ;STEP 1 Send("G*L") Send($oExcel.Application.Cells($a,1).Value) Send("/XUSR") Sleep(1000) Send("{ENTER}") Sleep(2000) ;===> Once the script has sent the above formats to 'MyApplication, A log file (Capture.log) is generated. What do I add as a link so the script moves to ;the following steps _FileReadToArray ($file, $arlines) For $i = $arlines [0] To 1 Step - 1 ; Script starts reading the log file from bottom up If $arlines [$i] = "‡NOT VALID" Then ;===> If I find the word '‡NOT VALID', then I want the script to go to STEP 1 in loop Else ;====> Else I want the script to do the following steps Send("MB") ; Continue sending formats to 'MyApplication' Send("{ENTER}") Sleep(2000) $iNum = StringRegExp(FileRead($file), "(?sm).*^\h*(\d{1,3})", 1)[0] ; Read number at a certain location in Capture.log file ConsoleWrite($iNum & @CRLF) EndIf ;====> Use the captured $iNum in the loop below. What do I add to proceed to the following steps For $i = 1 To $iNum Send("SET"& $i &"/USR") Sleep(500) Send("{ENTER}") Sleep(1000) ;====> Go back to STEP 1 $oExcel.Application.Quit I am a beginner and need help with If, then, else jump to specific loop in the script. Can I please get help with my script where I have multiple loops. I need to link the steps and also break the sequence and jump to specific loop if a certain condition is found in one loop.
  4. Hi Guys, Is it possible to get a variable on your For..Next loop? Local $Lines1 = _FileCountLines(C:\temp\test.txt) Local $linesToCount2 = $Lines1 + 2 $var = Number($linesToCount2) For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = $var To $count Next ;Code does stuff here Next Somehow my code doesn't work even though I thought I could convert the variable to a Integer / Number. This code I posted above does not move to the next value. But the code below does... why is that? For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = 2 To $count Next ;Code does stuff here Next Why is the For loop resetting itself? Is it because the program does not cache the variable and needs to keep on acquiring this variable each time? If so , how would you make this variable static?
  5. Hi is there a move next function or a way to loop so that the next item in a record is selected? I'm not sure where to start looking in order to find them. I want to click a text link and then do my macros, which I'm already finished with and then make it move to the next record. This is on a web browser it looks like this. The link is a date. I believe the page uses javascript Theres also a button for the bottom and I want it to do a whole date range 1/1/2016 - 7/1/2018
  6. hi all, Dumb question, but say I have a loop: dim $i Do     sleep(1000)          if $i = ; how do i do a function that enters this IF statement every 10 loops?         ; do stuff every 10     EndIf      Until $i = 100 - what commands in the if statement do I need to use to make it pass, and on every 10th loop, it enters the if statement. ? Thanks
  7. I've seen some weird behavior in my code (I log almost everything).    While 1       $WaitingTime = TimerDiff($wtTimer)       sleep(300)       $Data = TCPRecv($MainSocket, $MaxLength)       _FileWriteLog($LogFolder&"info.log", "Wait for answer that Server is ready for step 21")                            If $Data = "ByeBye" Then                                        _FileWriteLog($LogFolder&"info.log", "Server tells me to shutdown")                                        Terminate()                  ElseIf $Data = "Step 20 Finished on Server" Then                                         _FileWriteLog($LogFolder&"info.log", "Server answers it is ready for step 21")                                         ExitLoop                ElseIf $WaitingTime>4000 Then                                          _FileWriteLog($LogFolder&"info.log", "No Answer, we still continue" &$Data)                                          ExitLoop             EndIf    WEnd    _FileWriteLog($LogFolder&"info.log", "Left the WhileLoop") And my logs show this: 2016-10-24 00:52:39 : Wait for answer that Server is ready for step 21 2016-10-24 00:52:39 : (Logline from completely different loop) 2016-10-24 00:52:39 : (Logline from completely different loop) 2016-10-24 00:52:39 : (Logline from completely different loop) 2016-10-24 00:52:39 : (Logline from completely different loop) 2016-10-24 00:52:40 : Wait for answer that Server is ready for step 21 2016-10-24 00:52:40 : Server answers it is ready for step 21 How can this happen? (If there was a "Left the Whileloop" log in between I could imagine it could happen... but now? I thought AutoIT was singlethreaded...
  8. My function still making spells and ignoring if statement -snip- And this function returns true and i see spell is entering
  9. I am working at a script (thanks @Chimp for the help on my previous thread) operating on Firefox, based on two time-set loops that are doing the same operations with some differences. Now I need to execute a local video at a determinated hour (between 12 and 4). My question is What is the best way to determine a precise hour (hh:mm)? I tried While @Hour >= 12 & @MIN >= 00 And @HOUR <= 14 & @MIN < 30But the loop is being ignored, although in the moment I use only @Min for my tests everything works fine. This is the essential - and working - structure of the present script: #include <ff.au3> _FFStart() While @MIN >= 00 And @MIN < 30 ; 1st Firefox loop Firefox url loop (contains functions and if conditions) WEnd ;Open a new tab and runs a local video; While @MIN >= 32 And @MIN <= 59 ; 2nd Firefox loop Firefox url loop (contains functions and if conditions) WEndThanks in advance
  10. This is a repost, since the thread was deleted due to database issues. - https://www.autoitscript.com/forum/topic/173518-thread-deleted/ Hello fellow geeks I am making a small program for work, a tool with shortcuts and host monitoring. The program has several tab and I need help with the tab called "Servers/Hosts" The tab reads hostnames or ip adresses from an ini file and writes them to a listview. You can add or remove hosts, ping, connect with mstsc and delete the whole list. Now... Im checking for ip adresses on start of the program, or with a refresh button - so far so good.. It´s working. I also have a function to check if a host is online and write it to the listview, but i cant make it work (im not good enough yet) - (ALMOST SOLVED - Writing a dummyhost e.g. "test" as hostname, gets the status "Online" - im currently working on that ) This check needs to run every 10 seconds or so, among with the check for ip adresses. But again, (im not good enough yet) - (SOLVED USING AdlibRegister) I´ve tried to put the functions in a loop in different places in the script. They either "block" the script or hide it. If i can get the loop to work, there is no need for a refresh button. and i want to put the foldercheck in the VIKING tab in a similar loop, displaying a warning instead of having to click a button. (but thats a different question) I hope one of you briliant minds can help me along the way:) Thank you for your time. Tobias IT-Tools.V13.au3 Servers.ini
×
×
  • Create New...