Loading ...
Sorry, an error occurred while loading the content.

WP and Applescript in OSX

Expand Messages
  • John Rethorst
    Here s an Applescript and WP macro that, for purposes of illustration, is supposed to let you choose a file, open it in WP and display an alert with the file
    Message 1 of 1 , Jul 11, 2006
    • 0 Attachment
      Here's an Applescript and WP macro that, for purposes of illustration,
      is supposed to let you choose a file, open it in WP and display an
      alert with the file path.

      • Applescript:

      set theFile to choose file
      set fileString to theFile as string

      tell application "WordPerfect"
      activate
      open theFile
      Do Script {"ShowPath", fileString}
      end tell

      • Macro "ShowPath":

      Alert (ScriptVar01)

      The WP alert does not work in OSX, because Apple has changed
      many instances of text from ASCII to Unicode without labeling
      them as different. The Applescript passes a kind of text to WP
      that WP can't understand.

      Easy fix:

      Replace the one-line alias to string conversion. Instead of:

      set fileString to theFile as string

      do:

      set {text:fileString} to (theFile as string)

      which returns a traditional string.

      John R.
    Your message has been successfully submitted and would be delivered to recipients shortly.