Can I construct a variable name in AppleScript?

Is it possible to construct a string by concatination and then declare it to be an applescript variable? I have a strong feeling the answer is no because the compiler wouldn’t be able to deal with it but thought I’d ask.

Nova:

You sort of can, but you have to script Script Editor yourself to make it happen:

set desk_path to path to desktop folder as string
set save_file to desk_path & "Script002.scpt"
tell application "Script Editor"
	set doc to make new document
	set text of doc to "--This script brought to you by another script!
set this_list to {}
 repeat with j from 1 to 3 
 display dialog  j 
 end
"
	compile doc
	execute doc
	save doc in file save_file
end tell

Depending on what you want to do with your [new] variable, this could be a usable technique

Good luck,

Craig Smith

Model: Powermac dual G4
AppleScript: 2.1
Browser: Firefox 1.0
Operating System: Mac OS X (10.4)

For what purpose? This is very rarely necessary and usually bad practice.

Muddy thinking ---- I agree I don’t need to do this.