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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

    • omicron
      By omicron
      Hello!

      I am working on a function that I am just getting lost on. The goal is a multiple nested loop.

      Here are the steps:
      Contents of file1.txt::
      [topic] var1=Name var2=OtherName var3=SomeotheName Contents of file2.txt::
      [subTopic] top=sub1 top2=sub2 top3=sub3 The Shell I am working from::
      #include <file.au3> $file = "c:\yourfile.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) msgbox(0,'','the line ' & $i & ' is ' & $line) Next FileClose($file) Understanding however that the "msgbox" needs to then become a variable. in example the following::
      $file = "c:\yourfile.txt" FileOpen($file, 0) While true( prog.exe is running && "WinName" is open) do For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) ;Open File to log "current location of file 1" FileWriteLine ("filename", $i & ' is ' & $line) var = $line Next $file2 = "c:\yourfile.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) ; OpenFile to log "Current location of file 2" FileWriteLine ("filename", $i & ' is ' & $line) Next FileClose($file2) FileClose($file) The goal in written form is the following ::

      While in "OpenWindow"
          read from file 1 starting at line 1 until end of file.
         file 1 is a list of names to be searched.
         With $line selected, add this element to the element in file 2.
       
      The search of a variables in list 1 and list 2 differ on the amount of posts that day. (This is not a web based platform, it is a game) I need to search 2 names and take a screenshot of the out put. The sizes of the names list depend on the activity of names at the time of search.
      This loop continues until all the names from both lists have been searched. Mostly in the format of::
      File1= item
      File2= Vendor
       
      Item + Vendor  ( Capture screen, scroll) -- Not sure how to detect if I need to scroll)
       
      Thank you for your help and support!
    • Jackized
      By Jackized
      Is there a way to loop back to the beginning and keep the already entered data in the GUI Input boxes? I can GUIDelete and start a new GUI but all the typed data has to be redone. Here is a sample.

       
      #Include <GuiConstants.au3> Dim $msg,$okbutton,$cancelbutton,$objOU,$intAccValue,$strGroup1,$strGroup2 Dim $strFirstName,$strLastName,$strUserName,$strUserName2,$strPassword,$strDescription,$strContainer Dim $Combo,$Duration Do $Form1 = GuiCreate("", 300, 300)          GUISetBkColor(0xA6CAF0)         GuiCtrlCreateLabel("First Name:", 50, 10)         $strFirstName = GuiCtrlCreateInput("", 50, 25, 200, 20)         GUICtrlSetState ( $okbutton, $GUI_FOCUS )         GuiSetState()     $okbutton = GUICtrlCreateButton ("OK",75,240,50,20)     $cancelbutton = GUICtrlCreateButton ("Cancel",175,240,50,20) While 1     $msg = GUIGetMsg()     Select     Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton             Exit     Case $msg = $okbutton             $strFirstName = GUICtrlRead($strFirstName)             ExitLoop     EndSelect Wend $len = StringLen($strFirstName)     If $len > "20" then         MsgBox(0, "ERROR Name to long", $strFirstName & " can't be over 20 characters." & @CRLF & "Total: " & $len)         ;Exit         GUIDelete($Form1)     EndIf Until $len < "20" MsgBox(0, "Done", "")  
    • mrtgtr
      By mrtgtr
      I want to do something , after wait 2 min and again do same thing
      But I do do not want with sleep, it must be timer 
      How I do this ?
    • vati1011
      By vati1011
      Hey, guys.
      Currently, I'm using Opencv UDF and i'm  encountering issues with DLLOPEN(). it is failing and returning -1
      But, I cannot figure out why it is failing.
      I need help from people.
      I'm running windows 10 32bit.
      This's my code.
      #RequireAdmin $fileopen = DllOpen("opencv_core2413.dll") MsgBox(0,"Result",$fileopen) Example.au3opencv_core2413.dll
    • 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?

       
×