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

    • nacerbaaziz
      By nacerbaaziz
      Hi dear
      I have a question please
      Can we customize error messages in autoit script?
      I mean internal error messages
      for example
      AutoIt Error
      Line 4  (File "D:\my projects\NVDA Manager\New AutoIt v3
      Script.au3"):
      $script[1] = 1
      $script^ ERROR
      Error: Subscript used on non-accessible variable.
      For example, I want to customize this message
      Is this possible?
      am waiting for your answers
    • AnonymousX
      By AnonymousX
      Hello,
      I'm trying to make a program that can look at a folder directory, find all the CSV files, and then add the data from CSV's to an array. 
      The problem I seem to be running into is on the 2nd iteration (2nd file) when the script will not create an array. Could someone please help? Thanks in advance
       
      #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> Global $MasterArray RefineData() Func RefineData() Local $i, $filenum, $file, $csvArray, $sFilePath = @ScriptDir $fileList = _FileListToArrayRec($sFilePath, "*.csv", 1) ;Create and array of all .csv files within folder ;=====Loop through the .csv files within the folder====== For $filenum = 1 To UBound($fileList) - 1 Step 1 $file = $fileList[$filenum] $sFilePath = $sFilePath & "\" & $file ;=====Create array based on csv file===== _FileReadToArray($sFilePath, $csvArray, $FRTA_NOCOUNT, ",") _ArrayDisplay($csvArray,"File: " & $filenum) If $filenum = 1 Then $MasterArray = $csvArray _ArrayDisplay($MasterArray, "Master") Else $MasterArray = _ArrayColInsert($MasterArray, UBound($MasterArray)) ;want column added at end For $i = 0 To UBound($MasterArray)-1 Step 1 $MasterArray[$i][UBound($MasterArray) - 1] = $csvArray[$i][4] Next _ArrayDisplay($MasterArray, "Master") EndIf Next EndFunc ;==>RefineData  
    • ur
      By ur
      In the autoit file, if we add multiple libraries (both internal and custom created one)
       
      When we compile the code and run the exe, some time we are getting runtime errors.
      But the line number of error is not showing the exact line number, might be it is including the line number count of libraries also.
      Can you please suggest how to get the exact error line number.
      So, it will be useful for debugging.
    • Rskm
      By Rskm
      i have seen many pointing out issues related to this, i tried reading through them - still unable to solve mine.. i have a script which reads certain lines based on a search item, this is an iterative process - the ldflst_file gets updated for each iteration and the script finds the line number which has the search item. this works perfectly for few iterations, but stops in some cases abruptly with the error = 
      Subscript used on non-accessible variable $aRead^ ERROR I have verified that the search item is present in the file. what could be the reason for this code to stop in certain cases. thanks for help
      my code below (partial).. full code is in attachment
       
      local $aRead=FileReadToArray($ldflst_file)
      global $ldflst_var1=" JOINT  LOAD       FORCE(X)        FORCE(Y)        FORCE(Z)       MOMENT(X)       MOMENT(Y)       MOMENT(Z)"
       
      for $i= 0 to $ldflst_totlines    ; ldflst_totlines is total number of  lines in the file 'ldflst_file'

          if $aRead[$i]=$ldflst_var1 Then
              $ldflst_LFound=$i
              ExitLoop
              else
              EndIf
      Next
       
       
      nomo_new1.au3
    • MrCheese
      By MrCheese
      Hi guys,
       
      Wondering, is there a better way, likely to use 'for...next' to add a letter to each range, by moving right -> along a range of columns in excel.
      I currently use this, but its clunky.
      If $run = 1 Then $range = "B6:B41" If $run = 2 Then $range = "C6:C41" If $run = 3 Then $range = "D6:D41" If $run = 4 Then $range = "E6:E41" If $run = 5 Then $range = "F6:F41" If $run = 6 Then $range = "G6:G41" If $run = 7 Then $range = "H6:H41" If $run = 8 Then $range = "I6:I41" If $run = 9 Then $range = "J6:J41" If $run = 10 Then $range = "K6:K41" If $run = 11 Then $range = "L6:L41" If $run = 12 Then $range = "M6:M41" If $run = 13 Then $range = "N6:N41" If $run = 14 Then $range = "O6:O41" If $run = 15 Then $range = "P6:P41" If $run = 16 Then $range = "Q6:Q41" If $run = 17 Then $range = "R6:R41" If $run = 18 Then $range = "S6:S41" If $run = 19 Then $range = "T6:T41" If $run = 20 Then $range = "U6:U41" If $run = 21 Then $range = "V6:V41" If $run = 22 Then $range = "W6:W41" If $run = 23 Then $range = "X6:X41" If $run = 24 Then $range = "Y6:Y41" If $run = 25 Then $range = "Z6:Z41" If $run = 26 Then $range = "AA6:AA41" If $run = 27 Then $range = "AB6:AB41" If $run = 28 Then $range = "AC6:AC41" If $run = 29 Then $range = "AD6:AD41" If $run = 30 Then $range = "AE6:AE41" If $run = 31 Then $range = "AF6:AF41" If $run = 32 Then $range = "AG6:AG41" If $run = 33 Then $range = "AH6:AH41" If $run = 34 Then $range = "AI6:AI41" If $run = 35 Then $range = "AJ6:AJ41" If $run = 36 Then $range = "AK6:AK41" If $run = 37 Then $range = "AL6:AL41" If $run = 38 Then $range = "AM6:AM41" If $run = 39 Then $range = "AN6:AN41" If $run = 40 Then $range = "AO6:AO41" If $run = 41 Then $range = "AP6:AP41" If $run = 42 Then $range = "AQ6:AQ41" If $run = 43 Then $range = "AR6:AR41" If $run = 44 Then $range = "AS6:AS41" If $run = 45 Then $range = "AT6:AT41" If $run = 46 Then $range = "AU6:AU41" If $run = 47 Then $range = "AV6:AV41" If $run = 48 Then $range = "AW6:AW41" If $run = 49 Then $range = "AX6:AX41" If $run = 50 Then $range = "AY6:AY41"  
      Normally, if it was going down the rows, i'd use this:
       
      For $i = 0 To UBound($iRowCount) - 1 $row = $i + 1 $range = "B"&$row&":B"&$row+1 Next  
      so something like this, but i don't know how to code sequential columns:
      For $i = 0 To UBound($iColCount) - 1 $col = $i + 1 $range = $col&"1:"&$col&"40" Next  
      If I don't make sense, let me know.
      Any help would be great. thanks
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.