|
|
#1 |
|
Applescript: How do I create custom data types?
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: Code:
on randomID() --ID generation code end randomID set theid to randomID() Code:
to randomID --ID generation code end randomID set theID to randomID 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
Any help would be greatly appreciated!
__________________
Now available on the iPad App Store: Clean Cuisine Click here to load its App Store page. Last edited by moonman239; Jan 5, 2013 at 10:07 PM. Reason: Fixed a mistake in the second-to-last sentence. |
|
|
|
0
|
|
|
#2 |
|
When defining and calling handlers, you must include its parameters, even if there aren't any (in that case, you include a pair of empty parentheses after the handler name). The second form just uses labeled parameters instead of positional ones - see the Handler Basics section of the AppleScript Language Guide.
__________________
MacBook Pro / OS X Mountain Lion (10.8.3) / Xcode 4.6 / [various (much) older stuff keeping dust off the shelves] |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 10:00 PM.






Linear Mode
