newbie first post, Variable within URL string

set secondarylocation to 3333

property target_URL : "" & secondarylocation

open location target_URL 

I need to make a script that can insert a variable into a URL, so that I can generate a script for loading several variations of a single website. The variable will be anything, such as “/houses” or “/234232”

If I run the script with the variable “secondarylocation” within quotation marks it loads “” expectedly. The problem is without the quotes it tells me that secondarylocation is not defined, despite it being set in the first line of the script.

Once I get that done, I will have to be able to insert text into dialog boxes on the webpage. I was thinking GUI scripting for that, but it seems rather rigorous. Any ideas?

Thanks, sorry if I messed up the applescript loading thing.

Try this instead (properties should come first)

property secondarylocation : missing value
property target_URL : "" & secondarylocation

set secondarylocation to "/3333"
open location target_URL