AppleScript functions made easy

Terry Vogelaar terry at discovery.nl
Thu Feb 7 14:41:01 CST 2002


Sorry, there was a bug in the function I mailed this morning when only 2
parameters are used. Here is the improved version:

function AppleScriptFunction aFun, aFile
  put "set theScript to load script (alias "&quote&aFile&quote&")"&return& \
      "tell theScript to "&aFun&"(" into ASfunc
  if paramcount() > 2 then
    repeat with e = 3 to paramcount()
      put param(e) into f
      if param(e) is a number then
        put f & "," after ASfunc
      else
        put quote & f & quote & "," after ASfunc
      end if
    end repeat
    put ")" into last char of ASfunc
  else
    put ")" after ASfunc
  end if
  do ASfunc as applescript
end AppleScriptFunction

Terry





More information about the use-livecode mailing list