About that @@ feature

Moderator: Moderator Group

About that @@ feature

Postby claude.rivet » Wed Jan 21, 2015 8:58 pm

I think I need help with a small script, here goes an example:

Code: Select all
tblocator = 500
for 1 to 15
tbstring = textbox
tblocator+ = 1
VAdd,tbstring,tbstring,tblocator
tbstring+ = .text
WDCustomScriptText, for.index, @@tbstring
next


Rather than returning the value of textbox501.text for example, in returns the string "tbstring". AM I missing something in my macro for it to return the value of textbox501.text?

Thank you!
regards
claude.rivet
 
Posts: 67
Joined: Tue Aug 07, 2012 5:40 pm

Re: About that @@ feature

Postby malkuth23 » Wed Jan 21, 2015 11:20 pm

to change the value of a variable use:
Code: Select all
varX += 1

not
Code: Select all
varX+ = 1

What is:
Code: Select all
tbstring+ = .text
supposed to do?

Also, I don't think you need the @@ blocking characters.
Also, lose the spaces after the commas in your scripts. I believe they interfere.
You did not really say what you trying to do...
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 354
Joined: Tue Apr 20, 2010 7:14 pm
Location: New Orleans, LA

Re: About that @@ feature

Postby claude.rivet » Thu Jan 22, 2015 8:24 pm

What is:
Code: Select all
tbstring+ = .text

supposed to do?


Append .text at the end of the variable value

let's say I want to create a loop that would change the name of a bunch of buttons according to what the user entered in textboxes. The button are numbered 1 to 15 and the textboxes are numbered 501 to 515

I need to

Code: Select all
WDCustomScriptText, 1, textbox501.text


for each button, but I chose to make this in a loop so I "build" the name using a string variable

Code: Select all
tblocator = 500
for 1 to 15
tbstring = textbox
tblocator+ = 1
VAdd,tbstring,tbstring,tblocator
tbstring+ = .text
WDCustomScriptText, for.index, @@tbstring
next


tbstring on the first iteration of the loop will be "textbox501.text", it is I verified, the @@ basically should return the value of textbox501.text rather than the string contained in tbstring which is "textbox501.text".

Somehow it doesn't and I was wondering if that feature was upcoming or if it was already implemented and if it's the case, what am I doing wrong?
claude.rivet
 
Posts: 67
Joined: Tue Aug 07, 2012 5:40 pm

Re: About that @@ feature

Postby malkuth23 » Fri Jan 23, 2015 12:04 am

I think the += command only works with numeric values.

To append text I think you would need to use the VAdd script.

VAdd,VarName,Var1,Var2

So...

vadd,tbstring,tbstring,.text

But, I am not sure you will be able to use the period as that may be reserved for something else. This is why WD needs better blocking functions.
My solution in the past for things like this was to combine the text in nodes using the text combiner, then use the variable in a script.
I know it is ugly, but it did work.
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 354
Joined: Tue Apr 20, 2010 7:14 pm
Location: New Orleans, LA

Re: About that @@ feature

Postby claude.rivet » Fri Jan 23, 2015 5:28 pm

The problem isn't building the string, it works, it's easy to verify and I did, the resulting string IS textbox501.text on the first iteration and it is textbox502.text on the second and so on and so forth.

Code: Select all
WDCustomScriptText,1,textbox501.text


works, it does name the button according to what is located in textbox 501

What doesn't work is that using @@ before the string variable name (in this case tbstring) should return the value of the object referenced by the string rather than the string itself and it doesn't.
claude.rivet
 
Posts: 67
Joined: Tue Aug 07, 2012 5:40 pm

Re: About that @@ feature

Postby malkuth23 » Fri Jan 23, 2015 6:18 pm

Gotcha. Sorry about that.
Hopefully someone from Germany responds then... Sounds like a bug.
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 354
Joined: Tue Apr 20, 2010 7:14 pm
Location: New Orleans, LA

Re: About that @@ feature

Postby florian » Tue Jan 27, 2015 1:31 am

If I understand correctly, you are attempting to use the contents of a string variable to refer to another variable, correct?

Are there other examples of this concept working? I ask because it seems kind of suspect to me. In most programming languages there is a distinction between variable keys (names) and their values, it doesn't quite make sense to me to say (in pseudocode):

Code: Select all
string foo = "Hello World!";
string bar = "foo";
print $bar; // <----Here you expect the command interpreter to access bar, retrieve "foo" and feed this to the print statement so that it will return "Hello World!" ????


The issue being that print doesn't know to handle the variable you are feeding it in this way. I would assume that WDScript's "WDCustomScriptText" function isn't expecting to have to parse out your variable in search of a string that points to another variable. It just grabs the string and does that one thing it does.

If I am wrong about this I'd really like to know. I haven't been paying too much attention to recent developments in WDScript world.

Cheers!
-flo

"Wise men learn more from fools than fools from the wise."

Cato the Elder, Plutarch's Life of Cato
User avatar
florian
 
Posts: 162
Joined: Fri Jul 25, 2008 3:49 pm
Location: Los Angeles, CA

Re: About that @@ feature

Postby schoissi » Wed Mar 30, 2016 8:32 am

hi,
as florian wrote,
this is exactly what i'm currently looking for.

is it possible to "pass" the value of a variable into another?

thx,
Roman
schoissi
 
Posts: 74
Joined: Thu Jan 01, 2009 9:48 pm
Location: Seattle, USA

Re: About that @@ feature

Postby florian » Wed Mar 30, 2016 3:29 pm

programming generally doesn't work this way, for a whole bunch of reasons.

if you create a new thread explaining what you want to do exactly it's likely that someone here could help you solve your problem in a saner way.

for example:
having several different variables in which you store data, and then being able to select which one you want to pull the string from at run-time usually means that rather than having a bunch of names you keep track of for variables, what you probably really wanted was an array. they're cleaner and don't have arbitrary names. integer indexing also means that you can programatically select the one you want instead of creating a lookup list of 'if' statements to pick the right one.
-flo

"Wise men learn more from fools than fools from the wise."

Cato the Elder, Plutarch's Life of Cato
User avatar
florian
 
Posts: 162
Joined: Fri Jul 25, 2008 3:49 pm
Location: Los Angeles, CA

Re: About that @@ feature

Postby Thomas Mrozek » Mon Apr 04, 2016 1:36 pm

Hi All,
the @@ command is not processed in the way you are expecting, it is not processing the textbox contents. You'll have to use vgettextbox command as
Code: Select all
tblocator = 500
for 1 to 5
tblocator += 1
VGetTextboxText,gettext,tblocator
WDCustomScriptText, for.index,gettext
next

Is that what you wanted to do?
cheers
Thomas
Thomas Mrozek
Technical Support Engineer
User avatar
Thomas Mrozek
 
Posts: 120
Joined: Mon Apr 20, 2009 11:08 am


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 6 guests