Jump to content
Sign in to follow this  
TechCoder

_ArrayDisplay $sArrayRange = no data or Variable subscript badly formatted.:

Recommended Posts

TechCoder

 

ArrayDisplay ( Const ByRef $avArray [, $sTitle = "ArrayDisplay" [, $sArrayRange = "" [, $iFlags = 0 [, $vUser_Separator = Default [, $sHeader = Default [, $iMax_ColWidth = Default [, $iAlt_Color = Default [, $hUser_Function = ""]]]]]]]] )
The $sArrayRange parameter syntax is as follows:

    "7" - Show rows 0-7 with all columns

    "7:" - Show rows 7-end with all columns

    "|7" - Show all rows with columns 0-7

    "|7:" - Show all rows with columns 7-end

    "7|7" - Show rows 0-7 with columns 0-7

    "5:7" - Show rows 5-7 with all columns

    "|5:7" - Show all rows with columns 5-7

    "7|5:7" - Show rows 0-7 with columns 5-7

    "5:7|7" - Show rows 5-7 with columns 0-7

    "5:7|5:7" - Show rows 5-7 with columns 5-7

 >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.:

Share this post


Link to post
Share on other sites
Melba23

TechCoder,

The same old story - fix one thing and break something else. :(

This modified version works for me - please test it and let me know if it does for you. Comments from others welcome too:

<snip>

If everyone is happy then I will change the UDF for the next Beta release. :)

M23

Edited by Melba23
Beta code removed

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
guinness

The mod works for me.


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
TechCoder

That fixed that issue - now, I get all the data (yeah).

As an 'addition', I did the following mod;

Func _ArrayDisplayNoExit(Const ByRef $avArray, $sTitle = Default, $sArray_Range = Default, $iFlags = Default, $vUser_Separator = Default, $sHeader = Default, $iMax_ColWidth = Default, $iAlt_Color = Default, $hUser_Func = Default,$bPublic = FALSE)

;****************  insert this at the bottom of the Create buttons section ~ line 280
 
    If $bPublic Then
        GUICtrlSetState($cData_Label,$GUI_hide)
        GUICtrlSetState($cUser_Func,$GUI_hide)
        GUICtrlSetState($cExit_Script,$GUI_hide)
    EndIf

This allows me to use this function to display information to the public - more like the old function.

I was using (and prefer the look of) GUICtrlCreateList, however, in  larger searches, it is extremely slow to display (with 30,000+ records, GUICtrlCreateList takes over 13 minutes).  Using _ArrayDisplay, showing the same data is around 15 seconds, however, it is not desirable to have the User Function and Exit Script buttons showing, thus, the above small mod (I considered also shrinking the size of the GUI window, though felt the empty space was not 'bad' enough to add that).  

Another thing I found is that the splash dialog does not work in the current (nor mod above) version.  The problem is that, in my scenario (1D array), $iSubItem_End and $iSubItem_Start are both 0 and in the current version

If $iVerbose And ($iItem_End - $iItem_Start) * ($iSubItem_End - $iSubItem_Start) > 10000 Then

will ALWAYS result in 0

#include <Array.au3>
Global $aTestArray[20001]
For $i = 0 To 20000
    $aTestArray[$i] = 1
Next
_ArrayDisplay($aTestArray, "Splash Test for > 10000 records", "", 8)

checking values (put this in just before the "Display splash dialog if required" section

ConsoleWrite("$iItem_End is " & $iItem_End & @lf & "$iItem_Start is " & $iItem_Start & @lf & "$iSubItem_End is " & $iSubItem_End & @lf & "$iSubItem_Start is " & $iSubItem_Start & @lf)

shows

 

$iItem_End is 20000

$iItem_Start is 0
$iSubItem_End is 0
$iSubItem_Start is 0
 

 

However, changing this section (~ line 194 of UDF) clears it up (may not be the best way, but it works for me - I did not test 2D arrays);

; Display splash dialog if required
        ; mod by TechCoder to avoid multiplying by 0 on 1D array
    Local $iSubItem_Total
    If $iSubItem_End > 0 Then
        $iSubItem_Total = ($iSubItem_End - $iSubItem_Start)
    Else
        $iSubItem_Total = 1 ; avoid multiplying by 0
    EndIf
    If $iVerbose And ($iItem_End - $iItem_Start) * $iSubItem_Total > 10000 Then
        SplashTextOn("ArrayDisplay", "Preparing display" & @CRLF & @CRLF & "Please be patient", 300, 100)
    EndIf

 

The same old story - fix one thing and break something else.  :(

Those who have never felt the sting of this whip have never coded! :bonk:

 

EDIT: Fixed Display splash mod - it would have broken things too!  ;)

Edited by TechCoder

Share this post


Link to post
Share on other sites
Melba23

TechCoder,

Glad the fix works - thanks for pointing it out. :thumbsup:

The next Beta release will have an additional flag for the $iFlags parameter to hide all the buttons if required, so that is already covered. I used an older version to debug rapidly this morning which is why it did not appear in the code above. ;)

I will look into the splash code (and your suggested solution) this afternoon if my better half gives me the time - stand by for an update as and when. :)

M23

Edit:

Given the earlier fix to the display ranges, the splash fix is actually very simple - just add 1 to each of the ranges. ;)

Try this Beta version - including the no buttons code. You need the Beta to run it: :)

<snip>

Edited by Melba23
Beta code removed

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
TechCoder

The next Beta release will have an additional flag for the $iFlags parameter to hide all the buttons if required, so that is already covered.

Note that I'm not looking to hide ALL the buttons, as, in my scenario, I am showing the array (a list of 'exceptions' in my case) and the user may want to save it off, print it, etc. so they can work with it bit-by-bit later (I considered just opening Notepad, though the Array looks nicer)

I only want to hide the User Function and Exit Script buttons - the 'Copy' ones, in my case, have value (i.e., please consider the mod for $iFlags to have a couple more options - though I totally understand and agree that it is impossible to 'option' everything - I think that perhaps one to show/not the Exit Script button and {somehow - automatically or matching to the Exit one?} not showing the Function button if there is no function programmed)

Thanks for the kudos and for taking the suggestions under consideration.

Share this post


Link to post
Share on other sites
Melba23

TechCoder,

How about this? 32 hides all buttons; 16 leaves the "Copy" buttons - "User Func" button only displayed if needed: :huh:

<snip>

And did you see change concerning the splash code? Look for the <<<<<<<<<<<<<< line. ;)

M23

Edited by Melba23
Beta code removed

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
TechCoder

How about this - 32 hides all buttons; 16 leaves the "Copy" buttons? :huh:

I think that works great - though I would still, personally, prefer 

; current line
If Not IsFunc($hUser_Func) Then GUICtrlSetState($cUser_Func, $_ARRAYCONSTANT_GUI_DISABLE)

; new line (or equivalent)
If Not IsFunc($hUser_Func) Then GUICtrlSetState($cUser_Func, $GUI_HIDE)

Reasoning;

1. If it is a coder looking at the display, they already know they can put in a function if they want to, and having a button they can't push does nothing for them anyway.

2. If it is a 'public' view where a coder allows the Exit Script button (in the new version), the user also does not need a button they can't push that has wording they don't understand and/or doesn't relate to their situation (causes frustration and Tech Support questions...).

3. I don't like having buttons I can't change wording or functionality of (simply, 'redundant') being on screen (or, is that obvious???)  ;)

 

And did you see my edit above concerning the splash code?  ;)

Yeah, that works better than mine (not surprised as you understand that code inside/out) - I tested both versions against all numbers 'around' 10,000, using various start digits, etc. - your code worked, mine missed 'sometimes'.......

Share this post


Link to post
Share on other sites
Melba23

TechCoder,

Have you run the edited code above? I think not because now the "User Func" button only appears if there is a user function passed. ;)

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
TechCoder

I knew there was something else I wanted to say in that post - I don't have the BETA software (not exactly sure how to run it separately/differently than released stuff) and am running behind on a schedule right now - so, no, I did not run that directly.  Thought I looked through it well enough and didn't see that a non-function won't display - sorry, missed that.

Seems all the bases are covered on this one - thanks again.

Share this post


Link to post
Share on other sites
Melba23

TechCoder,

You can download the Beta from here - just install it along with the current release, it does not conflict. if you use the full SciTE4AutoIt3 package (download from here) you then get additional menu options to choose either release or Beta to run/compile. ;)

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
Melba23

Hi,

If anyone would be kind enough to test, here is the current Beta version of this function with a couple of example scripts:

<snip>

As always, happy to receive any comments. :)

M23

 

Edited by Melba23
Beta code removed

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
Melba23

Hi,

I spent some time while the forum was down polishing the code - if anyone wants to test the new UDF, here it is with an example:

 

M23

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
TechCoder

I look forward to testing it - in fact, I, too, was playing around a bit during the 'outage'.....  see what you think about these ideas (and, sorry if they are already done and I haven't seen them - I wanted to d/l the other day, but......).

mod for Array.au3  _ArrayDelete - add support for both types of arrays
 
; #FUNCTION# ====================================================================================================================
; Author ........: Cephas <cephas at clergy dot net>
; Modified.......: Jos van der Zande <jdeb at autoitscript dot com> - array passed ByRef
; Modified.......: TechCoder - $iArrayType to support both Array types
;                  $iArrayType = 0 - where $avArray[0] = contains the first file (default) (data starts at position 0)
;                  $iArrayType = 1 - where $avArray[0] contains the number of files (data starts at position 1)
;                  $iArrayType = 2 - auto-determine which type ('best guess' when $avArray[0] = UBound($avArray))
;                  @error = 5 for non-valid $iArrayType
; ===============================================================================================================================
Func _ArrayDelete_Mod(ByRef $avArray, $iElement,$iArrayType = 0)
If Not IsArray($avArray) Then Return SetError(1, 0, 0)
If Not $iArrayType = 0 and Not $iArrayType = 1 and not $iArrayType = 2 Then Return SetError(5, 0, 0)
Local $iUBound = UBound($avArray, 1) - 1
; Bounds checking
If $iElement < 0 Then $iElement = 0
If $iElement > $iUBound Then $iElement = $iUBound

; Move items after $iElement up by 1
Switch UBound($avArray, 0)
Case 1
For $i = $iElement To $iUBound - 1
$avArray[$i] = $avArray[$i + 1]
Next
ReDim $avArray[$iUBound]
Case 2
Local $iSubMax = UBound($avArray, 2) - 1
For $i = $iElement To $iUBound - 1
For $j = 0 To $iSubMax
$avArray[$i][$j] = $avArray[$i + 1][$j]
Next
Next
ReDim $avArray[$iUBound][$iSubMax + 1]
Case Else
Return SetError(3, 0, 0)
EndSwitch

; Mod [0] if needed (for number in [0] type Arrays)
Switch $iArrayType
Case 0
; do nothing
Case 1
$avArray[0] = $iUBound
Case 2
If $avArray[0] = $iUBound + 1 Then
$avArray[0] = $iUBound
EndIf
EndSwitch

Return $iUBound
EndFunc   ;==>_ArrayDelete_Mod

Also, I did a bit of mod on the Sound UDF (we can move this to another thread if you like)

mod to Sound.au3

 
Added ability to return REMAINING time in _SoundPos
 
; #FUNCTION# ====================================================================================================================
; Author ........: RazerM, Melba23
; Modified.......: $iMode 3/4 by TechCoder (3 = milliseconds remaining, 4 = hh:mm:ss remaining)
; ===============================================================================================================================
Func _SoundPos($aSndID, $iMode = 1)
;validate $iMode
If $iMode <> 1 And $iMode <> 2  And $iMode <> 3  And $iMode <> 4 Then Return SetError(1, 0, 0)
If Not __SoundChkSndID($aSndID) Then Return SetError(3, 0, 0) ; invalid Sound ID or file name

;tell mci to use time in milliseconds
__SoundMciSendString("set " & $aSndID[0] & " time format miliseconds")
;receive position of sound
Local $iSndPosMs = Number(__SoundMciSendString("status " & $aSndID[0] & " position", 255))
If $aSndID[1] <> 0 Then
$iSndPosMs -= $aSndID[2]
EndIf

If $iMode = 3 or $iMode = 4 Then
$iSndPosMs = _SoundLength($aSndID,2) - $iSndPosMs
EndIf

If $iMode = 2 Or $iMode = 4 Then Return $iSndPosMs

;$iMode = 1 (hh:mm:ss)

;modify data and assign to variables
Local $iSndPosMin, $iSndPosHour, $iSndPosSecs
__SoundTicksToTime($iSndPosMs, $iSndPosHour, $iSndPosMin, $iSndPosSecs)

;assign formatted data to $sSndPosFormat
Local $sSndPosHMS = StringFormat("%02i:%02i:%02i", $iSndPosHour, $iSndPosMin, $iSndPosSecs)

;return correct variable
Return $sSndPosHMS
EndFunc   ;==>_SoundPos

Made things a lot simpler in my music player to just return the timer other than having to calculate it again.

I'm working on another project that I got started on during the 'down' and once I finish that I will be getting into the Beta world - only so many hours in a day.......

Share this post


Link to post
Share on other sites
Melba23

TechCoder,

The next Beta will already have 2D support for most array functions - it was discussed at length here. ;)

I am not a fan of the change to Sound - the calculation is trivial and I see no point in complicating the UDF unnecessarily. :)

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

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

    • Ostap
      By Ostap
      I have a small script that checks if users from certain security groups exist or are disabled in AD. 
         For $j = Ubound ( $Users, 1 ) -1 To 0 Step -1       Switch _AD_IsObjectDisabled ( $Users[$j] )           Case 1             ClipPut ( $Users[$j] & " - account disabled; " )           Case 0             If @error = 1 Then                ClipPut ( $Users[$j] & " - account not found; " )             Else                ClipPut ( $Users[$j] & " - Ok; " )             EndIf       EndSwitch    $Clip = $Clip & @CRLF & ClipGet ()    Next   $Data[$O][1] = $Clip The code works correctly, at the end I have a 2D array $Data with security group in column 1 and checked user accounts in columns 2. However, _ArrayDisplay ( $Data ) shows users in one row, despite I added @CRLF. When I write $Clip to a text file, user accounts are written as column. Isn't it possible to have multiple-line cell split by @CRLF in _ArrayDisplay? 
    • 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!
    • TheDcoder
      By TheDcoder
      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
    • 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)


×

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.