TheDcoder

_ArrayDisplay Not working

9 posts in this topic

Hi, Please look at the code below:

#include <File.au3>
#include <Array.au3>

; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
#include <GuiListView.au3>

Global $hGUI = GUICreate("GUIx",283,120,-1,-1,-1,-1)
GUISetBkColor(0xFFFFFF,$hGUI)
$hListX = GUICtrlCreatelistview("ColumnX|ColumnY|ColumnZ",4,4,269,65,4,544)
; GUICtrlCreatelistview("ListX",7,4,269,65,-1,512)
GUICtrlSetData(-1, "ColumnX|ColumnY|ColumnZ")
$hButtonY = GUICtrlCreateButton("ButtonY",20,80,100,30,-1,-1)
$hButtonZ = GUICtrlCreateButton("ButtonZ",160,80,100,30,-1,-1)
GUISetState()

While True
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $hButtonY
            AddRows()

    EndSwitch
WEnd

Func AddRows()
    Local $aFiles = _FileListToArray(@ScriptFullPath & '\FolderX', Default, Default, True)
    _ArrayDisplay($aFiles)
    Local $aContent[9]
    For $i = 0 To UBound($aFiles) - 1
        MsgBox(0, "", $aFiles)
        $aContent = FileReadToArray($aFiles[$i])
    Next
    For $i = 0 To UBound($aContent) - 1 Step 3
        GUICtrlCreateListViewItem($aContent[$i] & '|' & $aContent[$i + 1] & '|' & $aContent[$i + 2], $hListX)
    Next
EndFunc

_ArrayDisplay at line no. 33 is not working, I don't know what is happening...

Thanks in Advance, TD :)

P.S Actually the code was for another question but while debugging the code, I encountered this problem


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites



debug much?

msgbox(0, '' , @ScriptFullPath & 'FolderX')


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

TheDcoder,

You may find it works better with @ScriptDir rather than (@ScriptFullPath. ;)

M23


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

Thanks for the alternative, still I wanna know the problem

TD :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

@Melba23 :blink: Why is it working know?? Please explain


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Click on the @ScriptFullPath in your code above and see what text that contains, the answer should be obvious.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thanks BrewManHN & Melba, For a moment i forgot that @ScriptFullPath returns the file's path

Sorry for the unnecessary trouble, TD :sweating:


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Also

For $i = 0 To UBound($aFiles) - 1 
; should be ... 
For $i = 1 To UBound($aFiles) - 1
; You've done this before as well.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

Thanks guinness :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

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

  • Similar Content

    • distancesprinter
      By distancesprinter
      _ArrayDisplay($aArray, "Window Title", "1:", 0, Default, "Column") ; Expected results are rows 1 to the end of the array, all columns. The result is rows 0-1, all columns. The API reference is here:
      https://www.autoitscript.com/autoit3/docs/libfunctions/_ArrayDisplay.htm
       
      Am I doing something wrong?
    • SorryButImaNewbie
      By SorryButImaNewbie
      Hello guys!
      I have a little problem in one of my function/functions. Here is my code:
      Func IsVisible($handle) If BitAND(WinGetState($handle), 4) Then ;If Not BitAND(WinGetState($handle), 16) Then If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndIf EndFunc ;==>IsVisible Func _GetWindows() ; Global $i = 12 ;Local $anumber = 0 / or use &i? Dim $VisibleWindows[1][2] = [["0", ""]] $AllWindows = WinList() For $i = 1 To $AllWindows[0][0] If IsVisible($AllWindows[$i][1]) Then If $AllWindows[$i][0] <> "" And $AllWindows[$i][0] <> "Program Manager" Then ReDim $VisibleWindows[UBound($VisibleWindows) + 1][2] $VisibleWindows[0][0] = $VisibleWindows[0][0] + 1 $VisibleWindows[($VisibleWindows[0][0])][0] = $AllWindows[$i][0] $VisibleWindows[($VisibleWindows[0][0])][1] = $AllWindows[$i][1] EndIf Else EndIf Next _ArrayDisplay($VisibleWindows, "Visible Windows") ;If WinClose("Visible Windows", "") = 1 Then Idle() EndFunc ;==>_GetWindows This should display all windows and their respective handels that WinList function can find, and display it in a "Visible Windows" titled arraydisplay. All good there, script runs as expected. I copied the code for the _GetWindows() from here, and implemented it with minimal changes as I recall (sorry I found it more then a month ago).
      My problem is that If I try to close the "Visible Windows" Window, the script just reopens anotherone, basicly the only thing I can do is terminate the script somehow after I started to display this. I'm pretty sure that there is something small that I miss, but since I can't really bend my mind around the _GetWindows array creation, I can't really pinpoint why it opens it again when I close it.
      (I try to used WinClose but thats just stupid since there is noproblem with closing, the problem is the reopening, realized that while I was writing it)
      Thank you for your help!
    • pseakins
      By pseakins
      I am running the production version of AutoIt 3.3.10.2 on Windows 7 Enterprise 64bit.
      I have found that _ArrayDisplay will go blank after several seconds. See the attached screen caps. The delay period is arbitrary. This occurs both in interpretive execution and in a compiled exe. This does not occur when I run the same code on a Windows XP SP3 machine with 3.3.10.2. The condition is consistent (for me) running the following code. 
      #include <Array.au3> Dim $array[10] = ['Running Windows 7 Enterprise 64bit', 'Just wait 5 to 30 seconds or so.', _ 'This ArrayDisplay will go blank (grey).', 'Clicking in the display will refresh', _ 'individual lines.', 'See the screencaps.'] _ArrayDisplay($array)


    • TechCoder
      By TechCoder
      >Running:(3.3.10.2):
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=ArrayDisplayTest.exe #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> Local $List[10] $List[0] = "JPM" $List[1] = "Holger" $List[2] = "Jon" $List[3] = "Larry" $List[4] = "Jeremy" $List[5] = "Valik" $List[6] = "Cyberslug" $List[7] = "Nutster" $List[8] = "JdeB" $List[9] = "Tylo" _ArrayDisplay($List, "Test of _ArrayDisplay", "") ; 10 rows, all data _ArrayDisplay($List, "Test of _ArrayDisplay", "7") ; 8 rows, no data _ArrayDisplay($List, "Test of _ArrayDisplay", "7:") ; 3 rows, no data _ArrayDisplay($List, "Test of _ArrayDisplay", "|7") ; 10 rows, no data ;_ArrayDisplay($List,"Test of _ArrayDisplay", "|7:" ) ; ==> Variable subscript badly formatted.: _ArrayDisplay($List, "Test of _ArrayDisplay", "7|7") ; 8 rows, no data _ArrayDisplay($List, "Test of _ArrayDisplay", "5:7") ; 3 rows, no data ;_ArrayDisplay($List,"Test of _ArrayDisplay", "|5:7" ) ; ==> Variable subscript badly formatted.: ;_ArrayDisplay($List,"Test of _ArrayDisplay", "7|5:7" ) ; ==> Variable subscript badly formatted.: _ArrayDisplay($List, "Test of _ArrayDisplay", "5:7|7") ; 3 rows, no data ;_ArrayDisplay($List,"Test of _ArrayDisplay", "5:7|5:7" ) ; ==> Variable subscript badly formatted.:
    • 1905russell
      By 1905russell
      Hi all, I've been away from Autoit for awhile but now I'm back trying to progress the accounting project I stopped and started several years ago.
      I've spent nearly two days trying to figure out this problem but alas I'm completely stumped.
      After the $aReadThisShelf array is created all elements can be accessed, however not to _ArrayDisplay().
      _ArrayDisplay() hangs for a short period and then returns blank and the array is gone. What have I done to screw this up?

      All help will be most appreciated.

      As always I have to give this disclaimer - Please remember I'm an accountant and not a programmer

      Here's the code


      #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> Opt('MustDeclareVars', 1) Global $hCombo, $sThisShelf Global $sMyTesterFile = "Tester.ini" GUICreate("", 395, 78, 292, 124, $WS_POPUPWINDOW) $hCombo = GUICtrlCreateCombo("", 16, 24, 176, 25, BitOR($CBS_DROPDOWN, $CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUISetState(@SW_SHOW) Local $var = IniReadSectionNames($sMyTesterFile) Local $VenArray[$var[0] + 1] For $i = 1 To UBound($var) - 1 $VenArray[$i] = $var[$i] GUICtrlSetData(-1, $VenArray[$i]) Next GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Local $nMsg $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) ;#forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo If Not IsHWnd($hCombo) Then $hWndCombo = GUICtrlGetHandle($hCombo) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $hCombo, $hWndCombo Switch $iCode Case $CBN_SELCHANGE $sThisShelf = GUICtrlRead($hCombo) Local $aReadThisShelf = IniReadSection($sMyTesterFile, $sThisShelf) _ArrayDisplay($aReadThisShelf, $sThisShelf & " has " & $aReadThisShelf[0][0] & " elements");here's the problem????? EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND
      Here's the tester.ini file


      [SHELF#1] Key1=Books Key2=paper Key3=shirts Key4=hats Key5=suits Key6=paperclips Key7=staples Key8=pens Key9=pencils Key11=erasers [SHELF#2] Key1=glasses Key2=plates Key3=saucers [SHELF#3] Key1=spoons Key2=knives Key3=bowls