Jump to content
Sign in to follow this  
Reinhardt1julian

For loop error

Recommended Posts

guinness

What does _GUICtrlListView_GetItemCount() return?


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Melba23

Reinhardt1julian,

The problem is obvious - in line 35829 you are not furgling the qualopper. :o

;....

Seriously, what on earth do you expect us to say when faced with a small syntactically incorrect snippet like that? Post the whole code and then you might stand a chance of getting a sensible answer. ;)

m23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Reinhardt1julian

It returns 46. I even tried to set the getItemCount as a variable before, add one and remove one to make sure it is an integer. But that didn't work either

Share this post


Link to post
Share on other sites
guinness

I agree with Melba23, I reckon there is more to this than just that code above.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Reinhardt1julian

Reinhardt1julian,

The problem is obvious - in line 35829 you are not furgling the qualopper. :o

;....

Seriously, what on earth do you expect us to say when faced with a small syntactically incorrect snippet like that? Post the whole code and then you might stand a chance of getting a sensible answer. ;)

m23

 

I know that it isn't that much. But my whole code is 1400 lines and the for loop alone is 150 lines. And

Share this post


Link to post
Share on other sites
guinness

the for loop alone is 150 lines.

Then it's probably further inside that For loop which is the issue. Why not work backwards and learn the art of debugging.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
jdelaney

Works fine for me.  Added your snippet into the base help file example

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hListView

    GUICreate("ListView Get Item Count", 400, 300)
    $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
    GUISetState()

    GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
    GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
    GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
    GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
    GUICtrlCreateListViewItem("line5|data5|more5", $hListView)

;~     MsgBox(4160, "Information", "Item Count: " & _GUICtrlListView_GetItemCount($hListView))

    ; Loop until user exits
    For $x = 1 to _GUICtrlListView_GetItemCount($hListView)
        MsgBox(0,"",$x&" of "&_GUICtrlListView_GetItemCount($hListView))
        ;some stuff here
    Next

    GUIDelete()
EndFunc   ;==>_Main

I bet, somewhere in your loop, you are setting x=x-1, or x-=1, so you never get above 1...or you have nested loops, both using the same variable (easy mistake in large loops).

example of that:

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hListView

    GUICreate("ListView Get Item Count", 400, 300)
    $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
    GUISetState()

    GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
    GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
    GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
    GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
    GUICtrlCreateListViewItem("line5|data5|more5", $hListView)

;~     MsgBox(4160, "Information", "Item Count: " & _GUICtrlListView_GetItemCount($hListView))

    ; Loop until user exits
;~  For $x = 1 to _GUICtrlListView_GetItemCount($hListView)
;~      MsgBox(0,"",$x&" of "&_GUICtrlListView_GetItemCount($hListView))
;~      ;some stuff here
;~  Next

    ; Loop until user exits
    For $x = 1 to _GUICtrlListView_GetItemCount($hListView)
        If MsgBox(1,"",$x&" will always be one...cancel to exit.") > 1 Then Exit
        $x-=1
        ;some stuff here
    Next

    GUIDelete()
EndFunc   ;==>_Main

If none of those help, then post your code :)...or at least code that reproduces it.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Reinhardt1julian

If you guys fins any problems in this code, tell me, but I will try to find it, too :D

;this won't run, because it needs a file
For $x = 1 to _GUICtrlListView_GetItemCount($List1data)
        $line = FileReadLine($tempFile, $x)
        MsgBox(0,"",$x&" of "&_GUICtrlListView_GetItemCount($List1data))
        If $line = "0" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $zero
                $zero[$zeronum] = $x-1
                $zeronum = $zeronum + 1
            Else
            EndIf
        ElseIf $line = "1" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $one
                $one[$onenum] = $x-1
                $onenum = $onenum + 1
            Else
            EndIf
        ElseIf $line = "2" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $two
                $two[$twonum] = $x-1
                $twonum = $twonum + 1
            Else
            EndIf
        ElseIf $line = "3" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $three
                $three[$threenum] = $x-1
                $threenum = $threenum + 1
            Else
            EndIf
        ElseIf $line = "4" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3)AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $four
                $four[$fournum] = $x-1
                $fournum = $fournum + 1
            Else
            EndIf
        ElseIf $line = "5" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $five
                $five[$fivenum] = $x-1
                $fivenum = $fivenum + 1
            Else
            EndIf
        ElseIf $line = "6" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $six
                $six[$sixnum] = $x-1
                $sixnum = $sixnum + 1
            Else
            EndIf
        ElseIf $line = "7" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $seven
                $seven[$sevennum] = $x-1
                $sevennum = $sevennum + 1
            Else
            EndIf
        ElseIf $line = "8" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $eight
                $eight[$eightnum] = $x-1
                $eightnum = $eightnum + 1
            Else
            EndIf
        ElseIf $line = "9" Then
            If _checkmess(_GUICtrlListView_GetItemTextString($List1data, $x-1),$x-1,$tag3) AND StringInStr($used,"'"&$x-1&"'") = 0 Then
                Global $nine
                $nine[$ninenum] = $x-1
                $ninenum = $ninenum + 1
            Else
            EndIf
        Else
        EndIf
        ;MsgBox(0,"",$zeronum&" - "&$onenum&" - "&$twonum&" - "&$threenum&" - "&$fournum&" - "&$fivenum&" - "&$sixnum&" - "&$sevennum&" - "&$eightnum&" - "&$ninenum)
        While 1
            If $zeronum > 0 Then
                If $zeronum = 1 Then
                    Return $zero[0]
                Else
                    Return $zero[Random(0,$zeronum-1)]
                EndIf
            ElseIf $onenum > 0 Then
                If $onenum = 1 Then
                    Return $one[0]
                Else
                    Return $one[Random(0,$onenum-1)]
                EndIf
            ElseIf $twonum > 0 Then
                If $twonum = 1 Then
                    Return $two[0]
                Else
                    Return $two[Random(0,$twonum-1)]
                EndIf
            ElseIf $threenum > 0 Then
                If $threenum = 1 Then
                    Return $three[0]
                Else
                    Return $three[Random(0,$threenum-1)]
                EndIf
            ElseIf $fournum > 0 Then
                If $fournum = 1 Then
                    Return $four[0]
                Else
                    Return $four[Random(0,$fournum-1)]
                EndIf
            ElseIf $fivenum > 0 Then
                If $fivenum = 1 Then
                    Return $five[0]
                Else
                    Return $five[Random(0,$fivenum-1)]
                EndIf
            ElseIf $sixnum > 0 Then
                If $sixnum = 1 Then
                    Return $six[0]
                Else
                    Return $six[Random(0,$sixnum-1)]
                EndIf
            ElseIf $sevennum > 0 Then
                If $sevennum = 1 Then
                    Return $seven[0]
                Else
                    Return $seven[Random(0,$sevennum-1)]
                EndIf
            ElseIf $eightnum > 0 Then
                If $eightnum = 1 Then
                    Return $eight[0]
                Else
                    Return $eight[Random(0,$eightnum-1)]
                EndIf
            ElseIf $ninenum > 0 Then
                If $ninenum = 1 Then
                    Return $nine[0]
                Else
                    Return $nine[Random(0,$ninenum-1)]
                EndIf
            Else
                Return False
            EndIf
        WEnd
    Next

Share this post


Link to post
Share on other sites
Melba23

Reinhardt1julian,

Do you have another loop inside that one which also uses $x as its variable? Perhaps you are resetting the count inside the loop to a high ennough value that when you get to the final Next you fall through rather than looping back. :huh:

M23

Edit: "Post" button pressed before the code above appeared. :)

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Reinhardt1julian

Reinhardt1julian,

Do you have another loop inside that one which also uses $x as its variable? Perhaps you are resetting the count inside the loop to a high ennough value that when you get to the final Next you fall through rather than looping back. :huh:

M23

 

Doesn't seem like it. I postet the whole loop. And i can't find any other $x in the3 code except in the for loop.

Share this post


Link to post
Share on other sites
jdelaney

You should look into functions to reduce the need to repeat blocks of the exact same code like that.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
DW1

The only way out of your while loop is "Return" so I guess this is inside a function.  If you are returning, then you are ending the function completely, both the For loop and the While loop.

EDIT: In other words, there is no way for the script to ever make it to "Next".

Edited by DW1
  • Like 1

Share this post


Link to post
Share on other sites
Reinhardt1julian

The only way out of your while loop is "Return" so I guess this is inside a function.  If you are returning, then you are ending the function completely, both the For loop and the While loop.

EDIT: In other words, there is no way for the script to ever make it to "Next".

 

Oh my god, thank you! That was such a stupid mistake to make :/

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Skeletor
      By Skeletor
      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?

       
    • xiantez
      By xiantez
      This script used to work on an older version of AutoIT. Currently I am running AutoIT v3.3.14.5 and it's failing.
      Func PublicIP() ;Post public facing IP address Local $url = 'https://www.google.com/search?client=opera&q=what+is+my+ip&sourceid=opera&ie=UTF-8&oe=UTF-8' Local $getIPaddress = BinaryToString(InetRead($url)) Local $sStart = 'clamp:2">' Local $sEnd = '</div>' Local $ipaddress = _StringBetween($getIPaddress, $sStart, $sEnd For $i In $ipaddress MsgBox(0, 'External IP', "Your public IP address is " & $i) Next EndFunc ;==>PublicIP The console output shows:
      "C:\Users\user\Documents\AutoIT\Scripts\WSI Tools.au3" (197) : ==> Variable must be of type "Object".: For $i In $ipaddress For $i In $ipaddress^ ERROR ->14:12:16 AutoIt3.exe ended.rc:1 +>14:12:16 AutoIt3Wrapper Finished. >Exit code: 1 Time: 9.811
    • Xandy
      By Xandy
      I'm listing the error message strings, and roughly matching the error code
      Is this how to do error reporting?  Is there a more simple way I don't know about?
      I realise I might not need to trap @error inside $error.  I like it this way b/c I have no fear of overwriting @error now; I don't even use it.
      Func Send_Connect($address, $port)     $socket = TCPConnect($address, $port)     $error = @error     If $error <> 0 Then         Local $aError[4] = ["-2 not connected.", _                             "1 IPAddr is incorrect.", _                             "2 port is incorrect."]         $aError[3] = "10060 Connection timed out."         If $error < 0 Then $error = 0         If $error > 2 Then $error = 3         MsgBox(0, "TCP Connect Error", $aError[$error], 0)         $socket = 0     EndIf     Return $socket EndFunc
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
    • Spartan117
      By Spartan117
      Hi everyone,
      I am wondering if is there any autoit function that make the program ignore errors and move on and resume correct lines?
      Thank you
×