Accessing AddressBook.data: javascript?

Ken Ray kray at sonsothunder.com
Wed Jan 11 08:39:25 EST 2006


On 1/11/06 7:36 AM, "Ken Ray" <kray at sonsothunder.com> wrote:

> Guys, you can download the Javascript component file for OSA from here:
> 
>    http://www.latenightsw.com/freeware/JavaScriptOSA/index.html

Oh, and if you're interested, here's a centralized "do script" function that
accepts AppleScript, VBScript and JavaScript:


function stsDoScript pScript,pScriptType,pDirectToConsole
  if pScriptType ="" then put "AppleScript" into pScriptType
  
  replace "`" with quote in pScript
  switch pScriptType
  case "AppleScript"
  case "AS"
    do pScript as "AppleScript"
    put the result into tResult
    break
  case "VB Script"
  case "VBS"
    set the hideConsoleWindows to true
    if pDirectToConsole = "" then
      put "C:\libVBS_temp.vbs" into tVBSPath
      put pScript into url ("file:" & tVBSPath)
      get shell("cscript.exe //nologo" && tVBSPath)
    else
      get shell("cscript.exe" && pScript)
    end if
    put it into tResult
    if there is a file tVBSPath then
      send "delete file" && quote & tVBSPath & quote to me in 1 second
    end if
    break
  case "JS"
  case "JavaScript"
    if "javascript" is among the lines of the alternateLanguages then
      do pScript as "JavaScript"
      put the result into tResult
    else
      put "Error: JavaScript OSA component not installed."
    end if
    break
  end switch
  return tResult
end stsDoScript

Enjoy!

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list