Sunday, November 27, 2022

#1 2003-04-13 10:58:27 am

Ray Barber
Site Admin
From:: Lake Dallas, Texas
Registered: 2002-11-20
Posts: 352

Parameters in Handlers

An example of optional parameters inside handlers using lists or records. From the AppleScript Users list

OS version: OS X


processArgs({1, 2, 3})
--> 30
processRecord({a:1, b:2, c:3})
--> {3,5}

on processArgs(args)
set x to 5
repeat with arg in args
set x to x * arg
end repeat
end processArgs

on processRecord(hash)
set len to count hash as list
set x to 5
set x to x + (d of hash)
end try
return {len, x}
end processRecord

Ray Barber
Admin | MacScripter



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)