weird quirk in Filemaker Pro 19 Perform AppleScript step

I use The Filemaker Pro 19 AppleScript step to do many file manipulations using AppleScript. I usually pass the results of the AppleScript to Filemaker by setting a text Field from within the AppleScript step. This has worked fine until I tried to create the following AppleScript. The Goal of the AppleScript was to find out if the Dropbox folder existed and if it existed see if the folder “Client Audio files” existed. If Client Audio files didn’t exist then create it. Finally pass the location of the DropBox folder back to Filemaker.

this script works great in ScriptEditor, but Fails in the Filemaker Pro 19 “Perform AppleScript” step.
The error Filemaker gives is “Parameter is not an Object specifier” and unknown Error -1727

–Does Dropbox exist

set {theDropboxFolder} to Does_Dropbox_Folder_Exist()

–send results to Filemaker Pro

setFilemakerpro(theDropboxFolder)

on Does_Dropbox_Folder_Exist()
set theDropboxFolder to (path to home folder as text) & “Dropbox:”

if exists (theDropboxFolder) then
	set theDropboxFolder to theDropboxFolder & "AllynDocuments:"
	set ClientAudioFiles to theDropboxFolder & "Client Audio files:"
	Make_Sure_There_is_Client_Audio_Folder(ClientAudioFiles)
else
	set theDropboxFolder to "No Dropbox Folder"
end if
return {theDropboxFolder}

end Does_Dropbox_Folder_Exist

on Make_Sure_There_is_Client_Audio_Folder(ClientAudioFiles)
tell application “Finder”
if not (exists folder ClientAudioFiles) then
make folder at myFolder with properties {name:“Client Audio files”}
display dialog “A folder for your Clients to download sound files was created in the dropbox folder. This folder named Client Audio files will contain a sound files you create.”
end if
end tell
end Make_Sure_There_is_Client_Audio_Folder

on setFilemakerpro(theDropboxFolder)
–tell Filemaker the DropBox location

tell application "FileMaker Pro"
	tell table "Preferences"
		tell record 1
			set cell "DropboxFolder" to theDropboxFolder
		end tell
	end tell
	
end tell

end setFilemakerpro

any thoughts

Hi:

I tested your setFilemakerpro handler in Catalina, and it works in both outiside from Script Editor and inside from a Filemaker button, so I’m guessing it’s a DropBox thing, which I know nothing about. Maybe some path variables are off?

I am thinking the same thing.
So I wondering if a work around could be….
Have the script make a folder on the desktop with the named for the path to the Dropbox
I would then have a second AppleScript get the name of the empty folder and delete the folder
Thoughts?

Not sure how that would help. I myself would focus on making sure the paths are all correct by “returning” the variables at various points in the script for inspection.

So I tested the following modification in ScriptEditor and in the Filemaker Pro 19 Perform AppleScript step. I put Display Dialog theDropBoxFolder in the applescript to see where it fails.

It works In the ScriptEditor
It fails in Filemaker between
display dialog theDropboxFolder & “1”
and
display dialog theDropboxFolder & “2”
This does not make sense to me

–Does Dropbox exist

set {theDropboxFolder} to Does_Dropbox_Folder_Exist()

–send results to Filemaker Pro

setFilemakerpro(theDropboxFolder)

on Does_Dropbox_Folder_Exist()
set theDropboxFolder to (path to home folder as text) & “Dropbox:”
display dialog theDropboxFolder & “1”
if exists (theDropboxFolder) then
set myFolder to theDropboxFolder & “AllynDocuments:”
set ClientAudioFiles to myFolder & “Client Audio files:”
display dialog theDropboxFolder & “2”
Make_Sure_There_is_Client_Audio_Folder(ClientAudioFiles, myFolder)
else
set theDropboxFolder to “No Dropbox Folder”
end if
display dialog theDropboxFolder & “3”
return {theDropboxFolder}
end Does_Dropbox_Folder_Exist

on Make_Sure_There_is_Client_Audio_Folder(ClientAudioFiles, myFolder)

tell application "Finder"
	if not (exists folder ClientAudioFiles) then
		make folder at myFolder with properties {name:"Client Audio files"}
		display dialog "A folder for your Clients to download sound files was created in the dropbox folder. This folder named Client Audio files will contain a sound files you create."
	end if
end tell

end Make_Sure_There_is_Client_Audio_Folder

on setFilemakerpro(theDropboxFolder)
–tell Filemaker the DropBox location
display dialog theDropboxFolder & “4”
tell application “FileMaker Pro”
tell table “Preferences”
tell record 1
set cell “DropboxFolder” to theDropboxFolder
end tell
end tell

end tell

end setFilemakerpro

I figured it out with your help

I was missing a Tell application Finder. It worked in the ScriptEditor because that was implied, but in Filemaker Pro it failed because the script thought I was referring to Filemaker Pro application

this script works in Filemaker Pro

--Does Dropbox exist

set {theDropboxFolder} to Does_Dropbox_Folder_Exist()

--send results to Filemaker Pro

setFilemakerpro(theDropboxFolder)


on Does_Dropbox_Folder_Exist()
	set theDropboxFolder to (path to home folder as text) & "Dropbox:"
	display dialog theDropboxFolder & "1"
	tell application "Finder"
		if exists (theDropboxFolder) then
			set myFolder to theDropboxFolder & "AllynDocuments:"
			set ClientAudioFiles to myFolder & "Client Audio files:"
			display dialog theDropboxFolder & "2"
			if not (exists folder ClientAudioFiles) then
				make folder at myFolder with properties {name:"Client Audio files"}
				display dialog "A folder for your Clients to download sound files was created in the dropbox folder. This folder named Client Audio files will contain a sound files you create."
			end if
			
		else
			set theDropboxFolder to "No Dropbox Folder"
		end if
	end tell
	display dialog theDropboxFolder & "3"
	return {theDropboxFolder}
end Does_Dropbox_Folder_Exist





on setFilemakerpro(theDropboxFolder)
	--tell Filemaker the DropBox location
	display dialog theDropboxFolder & "4"
	tell application "FileMaker Pro"
		tell table "Preferences"
			tell record 1
				set cell "DropboxFolder" to theDropboxFolder
			end tell
		end tell
		
	end tell
end setFilemakerpro

[applescript] and [/applescript] tags added by NG.

Hi Beeman.

Could you please MacScripter’s [applescript] and [/applescript] tags when posting AppleScript code here? (I’ve done it for you in your post immediately above.) There’s a button for them above the text field when you post. They make the code appear in a box with a link to open it in people’s default editors. Thanks.