Help with recurrinf 'If' statement

Discuss Interactive Design & Flash® (SWF) Export inside QuarkXPress 7, 8 & 9.
Exchange ideas, share helpful tips and get started with your first interactive design.
Please note that Flash (SWF) authoring is not supported in QuarkXPress 10 anymore.
Locked
MarkyBoy
Posts: 175
Joined: 22 Feb 2010, 10:58

Help with recurrinf 'If' statement

Post by MarkyBoy » 29 Nov 2012, 03:43

Hi all, I have a load of 'If' statements that look at the text in a text box and open a window according to what's in the text box... the code is as below:
TextBox1.GetSelectedText()===
If TextBox1.GetSelectedText()==="Answer A"
Open Window "window1"
End If
If TextBox1.GetSelectedText()==="Answer B"
Open Window "window1"
End If
If TextBox1.GetSelectedText()==="Answer C"
Open Window "window1"
End If
If TextBox1.GetSelectedText()==="Answer D"
Open Window "window1"
End If
If TextBox1.GetSelectedText()==="Answer E"
Open Window "window2"
End If
If TextBox1.GetSelectedText()==="Answer F"
Open Window "window2"
End If
If TextBox1.GetSelectedText()==="Answer G"
Open Window "window2"
End If

What I'd like to do is compact the script so that one If statement covers all options, so reducing the above code to something like:
TextBox1.GetSelectedText()===
If TextBox1.GetSelectedText()==="Answer A" OR "Answer B" OR "Answer "C" etc...
Open Window "window1"
End If
If TextBox1.GetSelectedText()==="Answer D" OR "Answer E" OR "Answer F" etc...
Open Window "window2"
End If

But I can't find an 'or' statement... Does anyone know how I can combine them something like above?

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

Help with recurrinf 'If' statement

Post by Matthias Guenther (Quark) » 03 Dec 2012, 22:26

Hi Mark,
first, you should use "==" for equal, not "===" please.
The OR statement is "||".
Thanks
Matthias

MarkyBoy
Posts: 175
Joined: 22 Feb 2010, 10:58

Help with recurrinf 'If' statement

Post by MarkyBoy » 03 Dec 2012, 22:42

Hi Matthias
Okay, it seems both "==" and "===" will work, why do you suggest using "==" ?
The OR statement?... Thank you! For some reason, I just could not find this in the list of operators, I must be going blind! Works fine!
I haven't quite finished this project, but would you be interested in seeing a preview?!

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

Help with recurrinf 'If' statement

Post by Matthias Guenther (Quark) » 04 Dec 2012, 02:53

Hi Mark,
=== is a strict equal, which means the datatype must also be correct. SO if you use this instead of == you alsways need to worry that you maybe compare two different datatypes and therefore ge a FALSE.
Regards
Matthias

Locked

Return to “General authoring questions”