grantwood Posted January 18, 2007 Posted January 18, 2007 Hello, I am trying to use an AppleScript from within FileMaker to copy a shipping address to a program called Endicia, which prints mailing labels and postage. The AppleScript works fine, except the address in Endicia doesn't handle the carriage returns properly (see attachment). What can I do to convert the carriage returns (which are ASCII 13 I think)? Do I need to convert them to ASCII 10 (LF)? Regards, Sean Mills
grantwood Posted January 19, 2007 Author Posted January 19, 2007 Hi Fenton, Thanks for pointing me in the right direction. I tried your suggestion, but I still got the same result, so after thinking some more, I tried the following: 1) Before calling the AppleScript from within ScriptMaker, I substituted the carriage returns in the shipping address with the text "" 2) In the AppleScript, instead of first setting the delimiters to ASCII character 13, I set them to "" That worked, although I'm still puzzled why first setting the delimiters to ASCII character 13 didn't work. Regards, Sean
Fenton Posted January 19, 2007 Posted January 19, 2007 I deleted my earlier post. Because you're right, and I should have remembered this. FileMaker's internal "returns" in a text field are actually ASCII 11. The reason my earlier example worked, when you wrote to a file, was because shell scripts translate to Mac returns for you when they write the file, at least when you use "echo." That's why I prefer to use them when writing files from FileMaker text. AppleScript's write command does NOT translate line endings. You get what you got, which is ASCII 11. I imagine if you're passing the AppleScript text to another app you also get ASCII 11. So we'd need to use that instead of ASCII 13 in our find/replace. Like this (the output path and writing the file is not what you need, but it's so others can see the result). set outputFile to (((path to desktop) as text) & "UnixText.txt") as file specification --tell application "FileMaker Pro Advanced" set txt to cell "_cAddress" of current record as text --end tell tell application "Finder" -- needed inside FileMaker try set AppleScript's text item delimiters to {ASCII character 11} set textList to text items of txt set AppleScript's text item delimiters to {ASCII character 10} set newTxt to (textList as text) on error errMess number errNum set AppleScript's text item delimiters to "" end try set AppleScript's text item delimiters to "" open for access outputFile with write permission set eof of outputFile to 0 write newTxt to outputFile starting at eof close access outputFile end tell
grantwood Posted January 19, 2007 Author Posted January 19, 2007 FWIW, I tried your updated script, but I still got the same results as seen in the screenshot, so I reverted to my workaround. I'm still puzzled LOL. All I'm doing is a glorified copy-and-paste. I'm not creating any text files.
John Fowler Posted February 4, 2007 Posted February 4, 2007 I use Endicia to print about 30,000 labels a year out of FMP. I guess I'm wondering why the Applescript? Why not export directly to Endicia via XML? No workarounds necessary there. Look up the threads on Endicia here--my questions and those of a few others were met with help galore. John
Recommended Posts
This topic is 6503 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now