Evaluating contents of a text field

You have completed your first interactive designs with QuarkXPress 7, 8 & 9 and now have need for more advanced functionality. Discuss Expressions here, ask questions and learn more about them.
Please note that Flash (SWF) authoring is not supported in QuarkXPress 10 anymore.
Posts: 54
Joined: 01 Jan 2011, 22:27

Evaluating contents of a text field

Post by shaharaperil » 10 Jan 2011, 04:00

Matthias replied with the following in another thread in reference to a script that would evaluate whether a user used the ENTER key on the keyboard to submit a password rather than clicking a submit button in the interactive project:
Matthias Guenther (Quark) wrote:Regarding the enter key, why don't you start a script that checks every second whether a /p is contained in the password field and if yes, it evaluates the password being correct?
As I was writing my script, I was stumped right from the beginning. I couldn't figure out which function tells the script to evaluate the contents of a text box and look for content, specifically the "/p." The two most obvious ones, Object.Contains and Object.ContainsPt, pertain to an object's coordinates and not the object's contents. The only comparison operator seems to be "==," but that only determines if the right and left are equal. Not whether the "right" is contained in the body of the "left."

Now that I'm looking at it again, I'm guessing "String.EqualIgnoreCase(s)" might work in conjunction with "Object.GetText()." I'll try that next. But is that the most logical combination to use or is there a more direct approach?

Matthias Guenther (Quark)
Posts: 2490
Joined: 04 Jun 2004, 15:06

Evaluating contents of a text field

Post by Matthias Guenther (Quark) » 10 Jan 2011, 05:44

Hi shaharaperil,
the function to get text content out of a text box is textboxname.GetText(). Assign that to a variable to make working with the content easier.
To find out whether certain characters are within a string you can use String.IndexOf(stringvariable,0). If it returns -1 then you know it is not in there.
Does that make sense?


Return to “Expressions”