• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
FMPro Advanced 9.03 & AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FMPro Advanced 9.03 & AppleScript


  • Subject: FMPro Advanced 9.03 & AppleScript
  • From: John Mitchell <email@hidden>
  • Date: Sat, 16 Apr 2011 16:44:18 +1000

Title: 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"
try
set filePath to navchoose file with prompt ¬
"Select attendee list" of extension {"txt"} without multiple files
on error
return
end try
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 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)
else
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)
else
-- 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 email@hidden 38599999}
When I save this as an FM Pro script the count is 1382 (characters, not words).
What is happening?
--

-------------------------------------------------
1005/2 Dind Street, Milsons Point, NSW 2061 Australia
tel: +61 (2) 9922 3785  fax: +61 (2) 9929 4035
email:email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Script to Enable to root user
  • Next by Date: Re: Excel: hide multiple columns with Applescript
  • Previous by thread: Re: Particulars of Finder Windows
  • Next by thread: Re: Excel: hide multiple columns with Applescript
  • Index(es):
    • Date
    • Thread