September 12, 200520 yr I can't find the solution to this anywhere, hopefully you can help. I'm writing an applescript that controls BBEdit's wonderful find and replace function to modify a link in a web page. The value it modifies is based on a LastName field in a Filemaker database. Here is the problem: When I set the variable LastName in Filemaker, BBEdit errors during the replace step. But when I set the variable directly all works fine. Here is how I set the variable in Filemaker: tell application "FileMaker Developer" tell current record of layout "data_entry_T" --script doesn't work if setting LastName using Filemaker set LastName to cell "Last Name" as string end tell end tell When I set the variable LastName directly the script works. set LastName to "Thiessen" This is the first time I've pulled data from Filemaker using applescript, could it be a text encoding problem? I've analyzed the Script Editor Event log and everything appears OK. Here is the step BBEdit errors on: replace LastName using "test" searching in linklist saving yes options s_option The error from BBedit is: "BBEdit got an error /Users/mthiesse/desktop/BALOG-BBVWRG-0012379.htm" doesn't understand replace message." Here is the entire code: tell application "FileMaker Developer" tell current record of layout "data_entry_T" set LastName to cell "Last Name up" as string end tell end tell tell application "BBEdit" --script works when I set LastName using line below --set LastName to "Balog" set linklist to "/Users/mthiesse/desktop/" & LastName & "-" & "BBVWRG" & ".htm" set s_option to {search mode:literal, starting at top:true, case sensitive:false, match words:true, extend selection:false, showing results:false} replace LastName using "test" searching in linklist saving yes options s_option end tell Edited September 12, 200520 yr by Guest
September 12, 200520 yr I would try this: Set LastName to cell "Last Name" as text ...instead of string! --sd
September 12, 200520 yr Author Thanks for your advice but changing "as string" to "as text" didn't help. Another interesting thing, you know how the Event Log replaces variables with the real values. I can copy the BBEdit part from the Event Log and paste it into a new ScriptEditor window and it will do the find and replace.
September 12, 200520 yr You don't have to use either "as string" or "as text". FileMaker text data is Unicode text, which is new in 7. So you can use "as Unicode text" if you want, but it's not necessary.
Create an account or sign in to comment