Problem with Input Instruction Logic

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
evangelmike
Pro Scripter
Posts: 56
Joined: Sun May 11, 2008 9:39 pm

Problem with Input Instruction Logic

Post by evangelmike » Fri Jun 06, 2008 4:58 am

Greetings! According to the manual's description of the Input instruction:
"It is possible to set a timeout by setting the value of INPUT_TIMEOUT before issuing the Input command. INPUT_TIMEOUT takes a number of milliseconds. If the Input box is still active after the timeout has elapsed it will be closed and the result set to YES."

When I run the following code, letting the Input timeout, MessageModal displays: "IssuerNDX = ; INPUTIssuerNDX = ". In other words, IssuerNDX is cleared, and INPUTIssuerNDX is not set to YES as expected. Regardless of whether or not Input times out, the resultant value of INPUTIssuerNDX should either be NO or YES. It took me about three hours to nail this one down. Please feel free to point out errors in my logic and to make suggestions, or to offer work-arounds. (I should add that when I accept the default input within the 5 second time limit, MessageModal displays:
IssuerNDX = 120; INPUTIssuerNDX = 120 as expected.)

Code: Select all

   // Set INPUT_TIMEOUT to 5 seconds:
   Let>INPUT_TIMEOUT=5000
   Let>IssuerNDX=120
   Let>DEFIssuerNDX=IssuerNDX
   Let>INPUTIssuerNDX=NO
   Input>INPUTIssuerNDX,Which row would you like to continue at?,DEFIssuerNDX
   // If the above Input times out, IssuerNDX should remain unchanged
   If>INPUTIssuerNDX<YES>IssuerNDX=INPUTIssuerNDX
   Endif
    MessageModal>IssuerNDX = %IssuerNDX%; INPUTIssuerNDX = %INPUTIssuerNDX%
May you have a blessed day!

Michael D Fitzpatrick
Reg. US Patent Agent

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Jun 06, 2008 3:27 pm

If>INPUTIssuerNDXIssuerNDX=INPUTIssuerNDX

You can't do that on one line like that, I think this is what you mean:

[code]
If>INPUTIssuerNDXYES
Let>IssuerNDX=INPUTIssuerNDX
Endif
[/code]

evangelmike
Pro Scripter
Posts: 56
Joined: Sun May 11, 2008 9:39 pm

Post by evangelmike » Fri Jun 06, 2008 4:03 pm

Greetings! Apparently the 'Code' button does not correctly handle the not-equals symbol. So, in the below code, I had to use /= to stand in for the not-equals symbol. Also apparently, the logic that handles this Message Body text also has a problem with the Not-Equals symbol. Which means that both the 'Code' button and the Message Body logic may have bugs. The code I tested should appear as (using /= for not-equals):

Code: Select all

   // Set INPUT_TIMEOUT to 5 seconds:
   Let>INPUT_TIMEOUT=5000
   Let>IssuerNDX=120
   Let>DEFIssuerNDX=IssuerNDX
   Let>INPUTIssuerNDX=NO
   Input>INPUTIssuerNDX,Which row would you like to continue at?,DEFIssuerNDX
   // If the above Input times out, IssuerNDX should remain unchanged
   If>INPUTIssuerNDX /=YES
      // then INPUTIssuerNDX should still be "NO"
      Let>IssuerNDX=INPUTIssuerNDX
   Endif
    MessageModal>IssuerNDX = %IssuerNDX%; INPUTIssuerNDX = %INPUTIssuerNDX%
When the 'Code' button and the Message Body Text handling logic are debugged, I can use for the not-equals symbol. (BTW, this is the only place that the not-equals symbol will display properly.)
May you have a blessed day!

Michael D Fitzpatrick
Reg. US Patent Agent

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Jun 06, 2008 5:00 pm

Oh yes, that's an ongoing issue despite Marcus' best efforts to outsmart phpbb by substituting a text box for the code box. Even though you are using the 'Code' button be sure to check the Disable HTML, BBCode, and Smilies boxes and it should be OK.

evangelmike
Pro Scripter
Posts: 56
Joined: Sun May 11, 2008 9:39 pm

Unable to turn HTML, BBCode, and Smilies

Post by evangelmike » Fri Jun 06, 2008 5:53 pm

Greetings! I tried clicking the Disable HTML, BBCode, and Smilies, and doing Preview ahows these Options as still all on. For example, having disabled these, I now try to post my original code, but as you can see, the Not-Equals sign still does not display correctly in my code: (YES is still displayed as , and the two lines are joined.)

[code]
// Set INPUT_TIMEOUT to 5 seconds:
Let>INPUT_TIMEOUT=5000
Let>IssuerNDX=120
Let>DEFIssuerNDX=IssuerNDX
Let>INPUTIssuerNDX=NO
Input>INPUTIssuerNDX,Which row would you like to continue at?,DEFIssuerNDX
// If the above Input times out, IssuerNDX should remain unchanged
If>INPUTIssuerNDXIssuerNDX=INPUTIssuerNDX
Endif
MessageModal>IssuerNDX = %IssuerNDX%; INPUTIssuerNDX = %INPUTIssuerNDX%
[/code]
May you have a blessed day!

Michael D Fitzpatrick
Reg. US Patent Agent

evangelmike
Pro Scripter
Posts: 56
Joined: Sun May 11, 2008 9:39 pm

Post by evangelmike » Fri Jun 06, 2008 6:18 pm

Greetings! The first sentence of my previous post has a typo and is not clear. It should read:
I clicked Disable HTML, BBCode, and Smilies, but doing Preview shows these Options as still all On.
May you have a blessed day!

Michael D Fitzpatrick
Reg. US Patent Agent

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Jun 07, 2008 7:57 pm

I agree it doesn't appear to work exactly as described in the Help, a timeout appears to work like hitting cancel, i.e. "If the Input dialog is cancelled (cancel is pressed) Input returns an empty string."

If you want it to default to the default, then a workaround would be to detect the empty result string and reassign a value to it.

[code]
Let>INPUT_TIMEOUT=3000
Let>default=25
Input>result,prompt,default
If>result=
Let>result=default
Endif
MDL>result

[/code]

P.S. Preview doesn't work with a text box.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts