Use of "return"
Use of "return"
- Subject: Use of "return"
- From: Steve Bird <email@hidden>
- Date: Wed, 18 Dec 2013 17:28:24 -0500
At the risk of revealing the true depths of my ignorance, I’ll ask this.
This script worked reliably for several months, on OSX 10.6 and earlier.
The script deals with text on a web page in Safari.
I quit using it for over a year.
The website which it processes has changed during that hiatus, and I upgraded to Mavericks.
In updating the script to work again, I found that previously working script code now works differently.
This snippet from a function:
set afterText to (theBidList of thisAuction as text) & return
set theLastBidNumber of thisAuction to N
Debug("Set the last Bid number to " & N as text)
… was failing to update the “theLastBidNumber” variable.
Adding the DEBUG statement (which writes out to a TextEdit window) shows that the DEBUG was not getting called.
However, rearranging the code:
set theLastBidNumber of thisAuction to N
Debug("Set the last Bid number to " & N as text)
set afterText to (theBidList of thisAuction as text) & return
Makes it work. All three lines are executing.
It acts like the “& return” is being interpreted as a “end this function and go back to the caller” sort of return, rather than a character to append.
Is that reasonable? Did something change between 10.6 and 10.9 ?
As it turns out, the line “set afterText to… “ is an unnecessary leftover: the variable is not used anywhere else.
But the line was there earlier and the “set theLastBidNumber” line was indeed executed.
Is there a new rule?
----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden