Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7011 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

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 by Guest
Posted

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.

Posted

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.

This topic is 7011 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.