Filemaker database problem PLEASE HELP!

Please can anyone help!

I’ve written a script which works fine when performed on a Filemaker database opened on the machine hosting it.

But when the same database is opened from another computer using ‘open remote’ the script stops at the 'set cellvalue of field to “blaa” line with an error stating ‘Object not found’.

Is there an issue with running Applescripts via “open remote” if so is there a way around this problem as it is very important that I get this sorted.

The problem section of the script is:

tell (create new record)
set cellValue of field “Number” to ResultNumber
end tell

As I said the script works fine unless the database is “open remote” also the access and priviledges set to ‘full access’.

Thanks for any help.

First, be sure you can manually enter values into the database when it’s open remotely.

This works for me


tell document DatabaseName of application "FileMaker Pro"
	set cell "Number" of current record to ResultNumber
end tell

Thanks for that!

I’ve used your suggestion and it does solve one problem, however now I have a new one !

I create a new record to enter the values in the cell but the values are not entered into the new record but into the currently selected one. I have tried getting the record ID and then using ‘go to record…’ but it doesn’t seem to recognise the ID of the new record even though I have just gotten it from the create new record command.

Any help would be appreciated.

and sorry for delay in thanking you as I have been away.

Tim

I do the same thing with some automation, this snippet from my script works (inside a FileMaker tell block):


	set new_record to create new record --create and get reference for new record
	go to new_record --make new record visible (refresh FileMaker view)

Thanks, but no luck !

The line
set new_record to create new record
works ok.

but…
go to new_record

generates an “Object not found” error.

I have tried from within different tell blocks (eg “Window 1”, “document 1”, “database 1”)

This is getting very frustrating because I can get this to work prefectly on the host computer but the same commands do not work when the database is open via “Open Remote”.

Tim

Hi Tim

Does this work:

tell application "FileMaker Pro"
	tell database "name of db goes here"
		set x to create new record with data {"a list of data"}--with data and list is optional
		show x
	end tell
end tell

Y’know what is very odd, is I’m getting that now too, but wasn’t before. Either that or FaceSpan was masking it from me somehow (i.e. the script of mine still worked despite the error). Sorry about that, I only just found this out when I was trying to debug the very script I pulled it from for other reason.

:frowning:

Not working for me…since I’m on a project needing this, hopefully I’ll have a solution shortly…or benefit from someone else having it sooner. :wink:

[EDIT:]
This is wierd, maybe because the database I’m trying to script is access from FileMaker Server (via the getURL script step), but Script Debugger is telling me that the new record has no record ID property: “Object not found (-1728)”

It’s almost like the “set” is not picking up a reference like I’m used to.

Figured it out, but you’re not going to like it (I know I don’t):

According to what I can discern, databases opened via Remote (getURL script step, for example) do not receive record properties. Script Debugger is somehow seeing a Record ID on creation, but the ID property is empty (Object Not Found -1728), so AppleScript can’t see it. I have no idea how ScriptDebugger is getting an ID reference.

My guess is because databases opened remote are “server controlled” (whether that be a remote workstation or FileMaker Server, the idea is the same) that the server is tracking this info somehow independent and invisible (for AppleScript purposes) to the local client.

So the script steps I gave above do work, but only on locally-opened databases.

I’m gonna keep digging, at least for today. Otherwise I may have to resort to UI scripting or other trickery. One idea is that in an unsorted list, the newest created record is always “last,” so maybe that is one way to get to it predictably.

EDIT: Less elegant than using record references, but works:


tell application "FileMaker Pro 8"
	activate
	getURL access_database_path_remote
	
	create new record
	go to last record
	
	set cell "Cell Name" of current record to "Some Data"
end tell

The problem with not using references of course is it is now relying on behavior (a little like UI scripting does). In an unsorted list, new records are always the last record, so this trick will work until FileMaker changes that behavior.

Thanks for that Kevin.

That seems to have solved the problem for now.

I guess if I need to set any cell values to a particular record I will need to show only that to be sure that it is the CURRENT record.

Thanks again everyone.

Tim