variable defined, but apple script disagrees

tell application "AppleWorks 6"
	tell spreadsheet layer of front document
		set a to {cell "A1", cell "b5"}
		set b to cell "b1"
	end tell
end tell

property home_URL : "http://www.yahoo.com"
property secondtarget_URL : b
property messagenewurl : home_URL & secondtarget_URL
get messagernewurl
open location messagenewurl

I’m trying to make a script that can load a list of URLs that have the same site, such as yahoo.com/realestate and yahoo.com/finance where ‘realestate’ is in appleworks cell A1 and ‘realestate’ is in cell A2.

Tyler:

This will properly extract cells A1 & A2 from ApplWorks, but I am absolutely clueless about why it will not compile with the remainder of the script. The error I get is that b is not defined, even if b is set to global.

tell application "AppleWorks 6"
	tell spreadsheet layer of front document
		set {a, b} to {cell "A1", cell "a2"}
	end tell
end tell

I admit that I do not use the [property] command at all, so I am unsure what the problem is.

Hi, Tyler.

You’re trying to compile values into properties from sources that won’t themselves be set until the script’s run. If you want to use properties for those values, you should compile them with place-holding values (‘missing value’ would do) and add lines that set them to what you want at run time.

property home_URL : "http://www.yahoo.com"
property secondtarget_URL : missing value
property messagenewurl : missing value

tell application "AppleWorks 6"
	tell spreadsheet layer of front document
		set a to {cell "A1", cell "b5"}
		set b to cell "b1"
		set secondtarget_URL to b
		set messagenewurl to home_URL & b 
	end tell
end tell

open location messagenewurl

Also, properties need to defined at the top of the script.