Naming Variables

I am wondering if there is any way to actually generate names for variables in a script. I am working on something that may require me to store items in a new variable whose name is determined by its cycle in a repeat loop.

Anyone have any ideas?

Thanks!

tim

Sort of a work around would be to create record labels on the fly

set variables to {}
repeat with i from 1 to 5
	set end of variables to "var" & i & ":\"\""
end repeat
set text item delimiters to ","
set variables to "{" & (variables as string) & "}"
set variables to run script variables

To refer to them you refer to them of the record

var1 of variables

And heres an example prompting user for the record labels to create

set variables to {}
repeat
	display dialog "Enter a variable name" default answer "" buttons {"Cancel", "Another", "Done"} cancel button 1
	tell result
		if button returned is "Done" then
			exit repeat
		else if text returned is not "" then
			set end of variables to text returned & ":\"\""
		end if
	end tell
end repeat
set text item delimiters to ","
set variables to "{" & (variables as string) & "}"
set variables to run script variables

Don’t know if that will help you or not, but have fun!

Thanks for those helps.

The one limitation I will have is that I don’t know how many variable names I will need at the outset.
Items are being taken out of a list until it is empty.

Could the variable name be generated in a handler?

How does one assign a new variable name to a statement, like

Set (new variable generated name) to (value) ?

Thanks for your help!

tim