Sign in to follow this  
Followers 0
dinodod

GuiCtrlCreateInput to an array

6 posts in this topic

:)

Is there any ability to have a GuiCtrlCreateInput with multiline option enabled to be passed to an array? I am trying to make a list of PCs that I want to check for something but I am having a problem with this function becoming an array. Right now, I have to use notepad.

CODE:

$Input_PCList = GuiCtrlCreateInput("hi", 310, 50, 270, 170,BitOr($ES_MULTILINE,$ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))

$Button_ListPCs = GuiCtrlCreateButton("List PCs", 50, 50, 90, 30)

---

Case $msg = $Button_ListPCs

;msgbox(0,"",GUICtrlRead($Input_PCList))

If Not _FileReadToArray(GUICtrlRead($Input_PCList),$PCList) Then

MsgBox(4096,"Error", " Error reading PC List. Error:" & @error)

;Exit

Else

For $x = 1 to $PCList[0]

Msgbox(0,'Record: ' & $x, $PCList[$x])

Next

EndIf


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites



Scratch that. I see what I am trying to do now. LOL.. a file function on a string variable :) Need to do more Mountain Dew. I haven't slept in almost 1 day now, no kidding. Look at GaFrost's avatar, that's me :D Coding freak.


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

Awesome, thanks for the tip!


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I am not seeing the light on this....

I have my inputbox with multiline option enabled

I then have my code which searches for @CRLF

yet when I test my script, I am getting an extra value being returned

when I try the following:

this

test

I get:

this

test

as being seen by my script. I thought it was the '\n' string I needed to add but thus far, it's eluded me. Thoughts??

____________________________________________________________________________________________________

____________________

Case $msg = $Button_ListPCs

$array = StringSplit(GUICtrlRead($Input_PCList), @CRLF, 0) ;@CRLF

msgbox(0,"",$array[0])

For $x = 1 to $array[0]

msgbox(0,"",$array[$x])

next

exit

Edited by dinodod

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I found StringStripCR & StringIsSpace by accident which poitned me to the right direction

$array = StringSplit(GUICtrlRead($Input_PCList), Chr(13), 1)

Also helps if I read the help content.

"Caution if you use the macro @CRLF you are referring to a 2 character string so you will generate extra blanks lines."

Edited by dinodod

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

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