Maybe the title was badly worded, but you'll understand what I mean after I explain what I want to do.
I want to make a script that creates multiple random, unique ID's. To accomplish this, I could do something like this:
but I thought I could do something like this:
Notice the lack of parentheses after "set theID to".
Somebody on a different forum was able to construct a method that would return a string with something in the string replaced with the value of another string. Here's his code:
When I tried the second block of code, AppleScript told me it expected something to follow "to randomID".
Any help would be greatly appreciated!
I want to make a script that creates multiple random, unique ID's. To accomplish this, I could do something like this:
Code:
on randomID()
--ID generation code
end randomID
set theid to randomID()
but I thought I could do something like this:
Code:
to randomID
--ID generation code
end randomID
set theID to randomID
Notice the lack of parentheses after "set theID to".
Somebody on a different forum was able to construct a method that would return a string with something in the string replaced with the value of another string. Here's his code:
Code:
to switchText from t to r instead of s
set d to text item delimiters
set text item delimiters to s
set t to t's text items
set text item delimiters to r
tell t to set t to item 1 & ({""} & rest)
set text item delimiters to d
t
end switchText
When I tried the second block of code, AppleScript told me it expected something to follow "to randomID".
Any help would be greatly appreciated!
Last edited: