0 Replies Latest reply on Apr 15, 2011 11:38 PM by JohnMitchell

    FMPro Advanced 9.03



      FMPro Advanced 9.03 & Applescript


      I'm on OS X 10.6.7, with a MacBookPro8,2.

      I have a database with over 100 applescripts saved as FM Scripts, and some hitting the character limit.

      I have this code in Applescript which correctly returns when run in Script Debugger. (I've stripped it down)

      tell application "Finder"


      set filePath to navchoose file with prompt ¬

      "Select attendee list" of extension {"txt"} without multiple files

      on error


      end try


      set FileRef to (open for access file filePath with write permission)

      on error errMsg number errNum

      end try

      set listFileName to (name of (filePath as alias))


      -- use the Unix LF as the record delimiter

      set memberList to (read FileRef as {text} using delimiter "


      close access FileRef

      end tell

      -- if a header is present, adjust item count

      set oldDelim to AppleScript's text item delimiters

      --set AppleScript's text item delimiters to "


      set fileHeader to (item 1 of memberList) as string

      display dialog fileHeader

      if character 2 of fileHeader is "*" then

      -- header present, decode

      set tokenCount to (count of words in fileHeader)

      repeat with i from 1 to tokenCount

      if i is 1 then

      set tokenArray to (word i of fileHeader)


      set tokenArray to tokenArray & return & (word i of fileHeader)

      end if

      end repeat

      -- remove header

      set newList to ""

      set memberCount to (count of items in memberList)

      set memberList to (items 2 thru memberCount of memberList)


      -- no header

      set tokenCount to 0

      end if

      -- reset count

      set memberCount to (count of items in memberList)

      --set AppleScript's text item delimiters to oldDelim

      --tell application "Finder"

      display dialog ("Found " & tokenCount as string) & " tokens"

      The answer is 12 in my file example (tab delimited and CR LF)

      {/* FirstName Surname Company Position Address Suburb State City PostCode AreaCode Email PhoneNumber

      Basil Fawlty SAG Consulting Engineers Design Technology Manager 584 Morton Road Wooton WA Brisbane 4999 07 asfawlty@towers.com 38599999}

      When I save this as an FM Pro script the count is 1382 (characters, not words).

      What is happening?