Page 1 of 1

Login

Posted: Tue Jul 19, 2011 3:02 am
by Kaubs
I dunno...seems right to me. I just rewrote this script...it was having an issue with the timer function...the "if it is 3" wasn't canceling correctly. I haven't been able to replicate the error again but after the message would pop up saying Account Created Successfully it would then pop up about 10 seconds later Network Unreachable. Am I thinking wrong in the way I am trying to manipulate the timer with this code? Cancel 1 being stop timer.

Thanks

Code: Select all

on mouseup
   send "timer" to me in 20 seconds
   focus on nothing
   set the visible of image "arrows" to true
   put fld "username" into tUNA
   put fld "password" into tPWA
   put "username=" & tUNA & "&password=" & tPWA into tauth
   post tauth to url "myurl"
   
   if it is "0" then
      cancel 1
      answer "Username or Password is blank"
      set the visible of image "arrows" to false
      
   else
      
      if it is "1" then
         cancel 1
         put specialfolderpath("documents") & "/text.txt" into tFile
         put tauth into url("file:" & tFile)
         go to card 3
         
      else
         
         if it is "2" then
            cancel 1
            answer "Invalid Username or Password"
            set the visible of image "arrows" to false
            
         else
            
            if it is "3" then
               cancel 1
               answer "Account Created Successfully"
               put specialfolderpath("documents") & "/text.txt" into tFile
               put tauth into url("file:" & tFile)
               go to card 3
               
            end if
         end if
      end if
   end if
end mouseup

command timer
   answer "Network Unreachable"
   set the visible of image "arrows" to false
end timer

end mouseup


Re: Login

Posted: Tue Jul 19, 2011 10:28 am
by Mark
Hi,

Cancel 1 would cancel a pending message with ID 1. You will never see a message with that ID, meaning that this command has no effect. Check the pendingMessages in the docs.

Check the focus command. I don't think "nothing" is valid syntax.

You got the format of the URL wrong. It should be of the form

http://domain.com/file.php?var1=x1&var2=x2&var3=x3

Where php could also be asp or cgi or irev or any other extenension.

After posting, you need to check the result for any errors. Read in the docs about the post command.

The string "myurl" really is just a string and not a URL.

You might want to change the answer command into answer [type] string, e.g. answer error "Wrong!" or "answer warning "Alert!".

Your timer handler will always run after 20 seconds. With proper error handling, you won't need this at all.

You have an orphan end mouseUp.

Best regards,

Mark

Re: Login

Posted: Tue Jul 19, 2011 5:18 pm
by Kaubs
Mark,

Thanks, for the help. I will look in to those issues. The Url is a correct URL, I just threw myurl in there to avoid putting my live connection on the web. Focus on nothing stops the keyboard from being active on the IOS. It allows for me to click the button and the keyboard goes away.

Thanks a ton!
Kaubs

Re: Login

Posted: Tue Jul 19, 2011 6:55 pm
by Kaubs
I've been reading definitions in the dictionary of the urlstatus command, the post command, send command and the cancel command. I understand that what you are saying is that cancel 1 should do nothing...that much makes sense...but it works for everything as far as stopping the timer other than on the Account Created IF statement. Could somebody please shed a little light on how it would be possible to find what the true ID of the command timer would be as it relates to the syntax I have listed above? I do not intend to use a timed message like that if I could properly use urlstatus (is this the correct method for error checking post?) but for some reason I cannot seem to make that work either....

Thanks!

Re: Login

Posted: Tue Jul 19, 2011 7:51 pm
by Kaubs
I think I figured out how the cancel command works. Still unsure about the urlstatus though.

Re: Login

Posted: Wed Jul 20, 2011 12:21 am
by Mark
Hi,

Do a search for pendingMessages on this forum. That will give you a lot of info. Here's a little more info on how to use it. In your case, you might want to search for the id numbers using a filter command:

Code: Select all

put the pendingMessages into myList
filter myList with "*timer*"
repeat for each line myMessage in myList
  cancel item 1 of myMessage
end repeat
Please, don't just copy/paste this little script. Make sure you understand how it works and modify it if needed.

Kind regards,

Mark

Re: Login

Posted: Wed Jul 20, 2011 4:51 pm
by Kaubs
Mark,
Thanks for your help. With your earlier guidance I had actually figured out how to do that. It works perfectly every time now.

Kaubs