Re: Problem with AppleScripting FileMaker
Re: Problem with AppleScripting FileMaker
- Subject: Re: Problem with AppleScripting FileMaker
- From: 2551phil <email@hidden>
- Date: Thu, 21 Jun 2018 19:58:33 +0700
>> Am I doing anything wrong?
I think so, and I suspect you answered you own question:
>> — this works because FileMaker always creates new records at ‘the end'
Right, but “at the end of what”?
I don’t have FileMaker, but it’s a standard pattern in AppleScript that if you
want to capture the result of a command you need to assign it to a variable;
you can then target that in a block.
e.g.
set aRec to create new record
tell aRec
…
end
But your tell (create new record) isn’t providing a reference to a new object;
it’s creating one and adding it to the end of the record list, but you’re not
providing the tell command with that reference just by executing the command.
OTH, last record works because that is a reference to the last object of the
record list.
Best
Phil
@sqwarq
> On 20 Jun 2018, at 21:09, Don Rossi <email@hidden> wrote:
>
> I'm sitting in front of the Atlantic Ocean and nowhere near my Mac right now.
> But, what happens when you tell the database object to “create new record”?
>
> I wrote my handlers for FileMaker so many years ago and I haven't needed to
> look at them. Your second example seems familiar to me. So, I suspect I've
> been down the same road.
>
> Sent from my iPad
>
> On Jun 20, 2018, at 4:56 AM, David Crowe <email@hidden
> <mailto:email@hidden>> wrote:
>
>> I have found that the following code does not work:
>>
>>
>> tell application "FileMaker Pro" to tell window "Meeting
>> Tracker" to tell layout "Temporary Folder Contents"
>> tell (create new record)
>> set {cell "thePrefix", cell "theNumber", cell
>> "thePartLetter", cell "theRevision", cell "FileName", cell "theRest", cell
>> "theExtension", cell "AttachmentType", cell "FileSize", cell "Contributor"}
>> to {theprefix, theNumber, thePartLetter, theRevision, theFileName, theRest,
>> theExtension, theKind, item i of theFolderSizeList, theContributor}
>> end tell
>> end tell
>>
>>
>>
>> If I replace the innermost line with something like: set cell “thePrefix” to
>> “abc”, I still get “Object not found”. Even just: cell “thePrefix” generates
>> the error.
>>
>>
>> On the other hand, the following code, which is equivalent, but more
>> complicated, works:
>>
>> tell application "FileMaker Pro" to tell window "Meeting Tracker" to tell
>> layout "Temporary Folder Contents"
>> create new record
>> tell last record — this works because FileMaker always creates new
>> records at ‘the end'
>> set {cell "thePrefix", cell "theNumber", cell "thePartLetter",
>> cell "theRevision", cell "FileName", cell "theRest", cell "theExtension",
>> cell "AttachmentType", cell "FileSize", cell "Contributor"} to {"abc",
>> "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yz", "012"}
>> end tell
>> end tell
>>
>>
>> Am I doing anything wrong? Or is the FileMaker AppleScript implementation
>> just broken?
>>
>> - David Crowe
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list (email@hidden
>> <mailto:email@hidden>)
>> Help/Unsubscribe/Update your Subscription:
>>
>> Archives: http://lists.apple.com/archives/applescript-users
>> <http://lists.apple.com/archives/applescript-users>
>>
>> This email sent to email@hidden <mailto:email@hidden>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden