Sign in to follow this  
Followers 0
Chimaera

_ArrayDisplay any other options?

25 posts in this topic

Having a little prob with displaying an array of items for a user

Ive obtained all 6 arrays then added together then used

$aArrayShow = _ArrayUnique( $aHKLM_Run_Deleted)

This works

$sFile = @ScriptDir & "\RegBackup\deleted_log.txt"
_FileWriteFromArray( $sFile , $aArrayShow)
ShellExecuteWait( $sFile)

Just dosent look nice opening a notepad

This works

_ArrayDisplay($aArrayShow, "Deleted Items")

Again doesnt look nice having the array box with the copy selected bit at the bottom and the excel type boxes etc

But this which is the one i would like to use doesnt work

SplashTextOn( "Removed Items", $aArrayShow & @CRLF)
Sleep(4000)
SplashOff()

it displays the splash fine but no text on it

Is there a simple way to get the splash to show the array items so i can make a better looking display?

The array is fine and working properly its the display of it that is an issue

Any suggestions?

Share this post


Link to post
Share on other sites



SplashTextOn doesn't support arrays being passed to it. Look at the GUI functions to create a 'custom' _ArrayDisplay() by using GUICtrlCreateListView & GUICtrlCreateListViewItem & to get an idea of how I did it or would do it look at the example


_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

I prefer to use _ArrayToString for something like this. Using your preferred method.

#include <Array.au3>
Global $aArrayShow[7] = [6, "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6"]
 
SplashTextOn( "Removed Items", _ArrayToString($aArrayShow, @CRLF, 1) & @CRLF)
Sleep(4000)
SplashOff()

Adam

Share this post


Link to post
Share on other sites

Thx adam ill have a look later

One extra question

When the array is made for every concatenate it has a number at the top so i end up with numbers here and there in the list.

Is there a way to exclude all numbers from the final list, the items the list will display has no numbers at all

$aArrayShow = _ArrayUnique($aHKLM_Run_Deleted)
$sFile = @HomeDrive & "\RegBackup\deleted_log.txt"
_FileWriteFromArray($sFile, $aArrayShow)
 
Local $SplashText = ''
   For $i = 2 To UBound($aArrayShow) - 1
    $SplashText &= $aArrayShow[$i] & @CRLF
   Next
   SplashTextOn("Removed Items", $SplashText, 250, 350, -1, -1, 6)
   Sleep(4000)
   SplashOff()

Share this post


Link to post
Share on other sites

When the array is made for every concatenate it has a number at the top so i end up with numbers here and there in the list.

I don't understand this, can you give a representation of what the splashtext looks like?


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Ok ill try but i haven't got a test one

From memory

2 ;<<<these 2 are from the main creation

1

Acer Assist Launcher

ACMON

4 ; << this one is added from one of the concatenates, its the header from another array

ISUSPM

What i want to see is

Acer Assist Launcher

ACMON

ISUSPM

does that make any sense?

Share this post


Link to post
Share on other sites

Perhaps something like this.

Local $SplashText = ''
For $i = 2 To UBound($aArrayShow) - 1
If Not StringIsAlNum($aArrayShow[$i]) Then; if the element is not just alpha numeric chars, then add it.
  $SplashText &= $aArrayShow[$i] & @CRLF
EndIf
Next
SplashTextOn("Removed Items", $SplashText, 250, 350, -1, -1, 6)
Sleep(4000)
SplashOff()

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

ok thanks i made a fake reg key to get a log

4
1
 
2
uTorrent

But the splash showed nothing i think the space maybe interfering

another test one

7
1
 
3
MSMSGS
nwiz
4
uTorrent

again splash was empty

Tried this with partial success

If Not StringIsAlNum($aArrayShow[$i]) Or Not StringIsSpace($aArrayShow[$i]) Then; if the element is not just alpha numeric chars, then add it.
   $SplashText &= $aArrayShow[$i] & @CRLF
   EndIf

7 ;<< it removed this
1;<< it removed this
     ;<< it removed this
3 ;<< but not this
MSMSGS
Edited by Chimaera

Share this post


Link to post
Share on other sites

I thought there might be a flag for this, but it seems not. The simplest way would be to delete the first element.

#include <Array.au3>
Local $aArray[8] = ["Bob","Bob","Alice","John","Jane","Alice","John","Mary"]
$aArray = _ArrayUnique($aArray)
_ArrayDisplay($aArray, "Before")
_ArrayDelete($aArray, 0)
_ArrayDisplay($aArray, "After")

Share this post


Link to post
Share on other sites

Ok i went back to the source for each array and removed the first element and the same for the unique and i still get a space but all numbers seem to have gone

If Not StringIsSpace($aArrayShow[$i]) Then
   $SplashText &= $aArrayShow[$i] & @CRLF
   EndIf

Im attempting to use this to remove the space but from testing i get the feeling it will still turn up

thx again

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I'm not sure where the spaces are coming from. I made a change to John's code above. Does this remove the spaces?

Local $SplashText = ''
For $i = 0 To UBound($aArrayShow) -2 ; <== Changed this
$SplashText &= $aArrayShow[$i] & @CRLF
Next
$SplashText &= $aArrayShow[$i] ; <== Do not concatenate @CRLF at the end
SplashTextOn( "Removed Items", $SplashText)

Hmm, I think I'm wrong there. It was just a quick guess. Perhaps you could post the code you have ATM.

Edited by czardas

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

the space is the 0 part of the array

ur code gave me

ACMON
Adobe ARM

in the save file but the splash was

ACMON

weird

without ur addition it shows both items in the splash with a space above them

truthfully the extra space above the items isnt that big a deal now i have no numbers, ill play around and see what happens

thanks again

Edited by Chimaera

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

How about this?

Local $SplashText = ''
For $i = 2 To UBound($aArrayShow) - 1
If Not StringIsAlNum(StringStripWS($aArrayShow[$i],8)) Then; if the element is not just alpha numeric chars after all white space removed, then add it.
  $SplashText &= $aArrayShow[$i] & @CRLF
EndIf
Next
SplashTextOn("Removed Items", $SplashText, 250, 350, -1, -1, 6)
Sleep(4000)
SplashOff()
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Yeah that's strange. It must be something in your code. When you say 'the space is the 0 part of the array', do you mean it is the first element (element zero). Is it just an empty string? You could try:this:

Local $SplashText = ''
For $i = 0 To UBound($aArrayShow) -1
If ($aArrayShow[$i] = "") Or StringIsSpace($aArrayShow[$i]) Then ContinueLoop ; Return to the start of the loop
$SplashText &= $aArrayShow[$i] & @CRLF
Next
SplashTextOn( "Removed Items", $SplashText)

Share this post


Link to post
Share on other sites

With a combination of both its sorted now as far as removing the the uneeded chars

The only thing im curious about is..

Is there a way to list a total for how many it has found?

So that i can display a count it has found "X" items for removal?

I had a look at

Local $aResult = _ArrayFindAll($SplashText, "") < tried 0 as well
   ConsoleWrite($aResult)

But it just reurns -1 either way

Then i noticed _ArrayCombinations gives this

Returns an array, the first element ($array[0]) contains the number of strings returned.

So is there a way to give me just the number of strings?

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Count as you go along. From the previous example:

Local $SplashText = ''
Local $iCount = 0
For $i = 0 To UBound($aArrayShow) -1
If ($aArrayShow[$i] = "") Or StringIsSpace($aArrayShow[$i]) Then ContinueLoop ; Return to the start of the loop
$SplashText &= $aArrayShow[$i] & @CRLF
$iCount += 1
Next
SplashTextOn( "Removed Items", $SplashText)

Subtract $iCount from the total to get the number of items removed.

Edited by czardas

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  
Followers 0