Page 2 of 2

Re: Help with XML in variable please.

Posted: Tue May 14, 2013 7:16 pm
by drolaz
Mark,
I feel like a complete *** .
It seems that in the field properties there were two lines of the IP Address. Hence the error.
And now your code works!
To that I send you a digital beer of your choice, and raise my glass to you!

If I can bug you for one more thing... :)

Is there a way to lock my field so it only excepts xxx.xxx.xxx.xxx ??

If I am being a pain I am truly sorry and your help has been a huge help!

Thanks
Al

Re: Help with XML in variable please.

Posted: Tue May 14, 2013 7:28 pm
by Mark
Hi Al,

You can set the lockText of the field to true. You can also use the properties inspector for this.

You could also check the contents of the field at the start of your script:

constant dot = "."

Code: Select all

on mouseUp
  put fld "ipaddy" into IpAddress
  if number of items of IpAddressis 4 then
    repeat for each item myItem in IpAddress
      if myItem is not an integer then
        beep
        answer error "Please, enter a correct IP address."
        exit mouseUp
      end if
    end repeat
  else
    beep
    answer error "Please, enter a correct IP address."
    exit mouseUp
  end if
  // remainder of your script here
end mouseUp
Kind regards,

Mark

Re: Help with XML in variable please.

Posted: Tue May 14, 2013 8:06 pm
by drolaz
Beautiful!

Thank you Mark for all your time and help it is greatly appreciated.

Al

Re: Help with XML in variable please.

Posted: Tue May 14, 2013 8:08 pm
by Mark
You're welcome, Al.

Mark