Getting a variable without " or []

I’m trying to create a variable from a unique identifier
I have tried using this code:
put [“JBTestAgg “, (formattedTime(”%B %e %H:%M:%S”, Time))] into myvar

But this brings back

["JBTestAgg ",“June 21 15:43:28”]

Any help gratefully received.

What is an example of what you are wanting?
Are you looking for something like this:

set myvar to "JBTestAgg"&FormattedTime("SSSSSS", the time)
put myvar

which returns: JBTestAgg649000

I wouldn’t want colons and spaces in my unique var, but you could also do it with your formatting:

set myvar to "JBTestAgg"&&FormattedTime("%B %e %H:%M:%S", the Time)
put myvar

The seconds function is probably better for what you need:,Seconds%20Function,-Behavior%3A%20Returns

set myvar to "JBTestAgg"&the seconds
put myvar

It sounds like you’re trying to dynamically create a variable name. You can’t do that and it doesn’t really make sense to do it if you could – you wouldn’t know what the name was that you had created, so you couldn’t reference the variable name after creating it, which defeats the purpose of having a variable.

1 Like

The unique reference is so that I can reference the variable in another script. Basically, I create a record, then go back though another menu to ensure it has been created and then edit it. The simplest way I could think of doing it was to create the name using a timestamp as the unique identifier and enter it using typetext, use readtext to record it and put it into a global variable, for use in the other script.
I found that readtext often gave incorrect results, so I thought of using put to get the name, but put inserts a lot of punctuation.

Yes, that’s great. Thanks!+

1 Like

Yes, that works for me. Cheers!

1 Like