Sign in to follow this  
Followers 0
LiberrY

Text Output with variables

4 posts in this topic

Hello there. I have a little problem, so I hope you can help me >_<

At this time it's looking like this:

Posted Image

But I don't know, how to do the part with the variables.

At the moment i can only define Part 1 of the text, then the color and Part II (where the values should be) .. and then he puts part I in color brackets and part II at the end.

I want to read out the "%x" from the first part - define them in the second part and put them into my output.

I hope you know how I want the program to work. If not ask and I will explain a bit more detailed :(

Share this post


Link to post
Share on other sites



Hello there. I have a little problem, so I hope you can help me >_<

At this time it's looking like this:

Posted Image

But I don't know, how to do the part with the variables.

At the moment i can only define Part 1 of the text, then the color and Part II (where the values should be) .. and then he puts part I in color brackets and part II at the end.

I want to read out the "%x" from the first part - define them in the second part and put them into my output.

I hope you know how I want the program to work. If not ask and I will explain a bit more detailed :(

Try using %%x instead of %x

Share this post


Link to post
Share on other sites

Ok, this was not what I wanted to hear, but I got it working now.

My next question is: how can I make a "Return" with GuiCtrlSetData() ?

Share this post


Link to post
Share on other sites

Ok, this was not what I wanted to hear, but I got it working now.

My next question is: how can I make a "Return" with GuiCtrlSetData() ?

Hi LiberrY

Did you think about something like that (to simplify example just Inputs, no Lists)

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)
$Form2 = GUICreate("", 413, 184, 302, 218)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
$input1 = GUICtrlCreateInput("Part I with var %x and %x", 20, 32, 361, 21)
GUICtrlSetOnEvent(-1, "HandleVars")
$input2 = GUICtrlCreateInput("100; 2;", 20, 108, 169, 21)
GUICtrlSetOnEvent(-1, "HandleVars")
$output = GUICtrlCreateInput("Output", 208, 108, 169, 21)
$btnConvert = GUICtrlCreateButton("Convert", 24, 148, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "HandleVars")
GUISetState(@SW_SHOW)

While 1
 Sleep(100)
WEnd

Func Quit()
 Exit
EndFunc

Func HandleVars()
 $string = GUICtrlRead($input1)
 ; parse $input2 for pattern: 'Number' {... 'Number'} followed by ';'
 ; the '('..')' will return only the 'number' part(s) in an array
 $valArray = StringRegExp( GUICtrlRead($input2), "(\d+);", 3)

    For $i = 0 To UBound($valArray) - 1
    $string  = StringReplace($string, "%x", $valArray[$i], 1)
 Next

 GUICtrlSetData($output, $string)
EndFunc   ;==>HandleVars

For Listboxes, you just use

_GUICtrlListBox_SetItemData($hLstBox, $iIndex, $string)

to output above $string in row $iIndex.

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