Help
Help
- Subject: Help
- From: Animals R' Not Ours <email@hidden>
- Date: Sat, 30 Jun 2018 19:30:14 -0700
Sudo —h
Sent from my iPad
> On Jun 25, 2018, at 10:27 AM, email@hidden wrote:
>
> Send AppleScript-Users mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.apple.com/mailman/listinfo/applescript-users
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of AppleScript-Users digest..."
>
>
> Today's Topics:
>
> 1. Re: AppleScript with FileMaker (Don Rossi)
> 2. Re: AppleScript script unable to respond to a script
> statement correctly (Deivy Petrescu)
> 3. Re: AppleScript with FileMaker (David Crowe)
> 4. Re: AppleScript with FileMaker (Jim Weisbin)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 25 Jun 2018 11:19:33 -0400
> From: Don Rossi <email@hidden>
> To: asu <email@hidden>
> Subject: Re: AppleScript with FileMaker
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> I’ve been doing this since Filemaker 5
> 1. Every FM solution has table called “Applescripts” and every field in there
> is a global
>
> 2. In the Applescripts tabled is ALWAYS a field called “as_readytorun_g” and
> one called “as_result”
>
> 3. Other fields are called “as_” + some description of script function
> (as_copy_file)
> These fields contain a “raw” applescript with values to be substituted all
> those values are like this:
> set my_db_name to “xyxy_database_name”
> Anything that begins with “xyxy_”, I know that is something that must be
> substituted into the script. I try to keep this at the top of the raw
> applescript
>
> 4 Create a FM script that will substitute the raw applescript field into
> “as_readytorun_g” and replace “xyxy_” values with data necessary. Name this
> FM script very much like the raw applescript field.
>
> There are other very specific steps I follow but this is a synopsis.
>
> This has worked for me for many many years. The beauty is that every script
> is a clean copy of the applescript. Years ago when there were buggy, memory
> leaking applescripts, my solution never crashed
>
>
>> On Jun 25, 2018, at 10:36 AM, Jim Weisbin <email@hidden> wrote:
>>
>> On Fri, 22 Jun 2018 David Crowe <email@hidden
>> <mailto:email@hidden>> wrote:
>>
>>>
>>> IV. Method 4. Capture the actual AppleScript.
>>>
>>> You cannot run the calculated string in an external editor for two reasons.
>>> First of all, it contains escaped quote marks, strange line markers (¶) and
>>> FileMaker calculations. So, if you had your entire script within a
>>> FileMaker calculated string, how would you debug it?
>>>
>>> Well, it’s actually quite simple (although it took me a long time to think
>>> of it). Write a simple FileMaker script that takes an AppleScript as a
>>> parameter, copies it to a FileMaker field and then executes it. If you then
>>> want to do some debugging you just take the executed source from the
>>> FileMaker field and copy it into a script editor. Once you debug it you
>>> have to edit changes back into FileMaker watching for escaping quotes and
>>> line endings, but if the changes are small it’s not so bad. If you
>>> completely rewrite the script externally, then with an editor you need to
>>> globally change all straight double quotes to \” and all line endings to ¶.
>>> Again, not bad once you get used to it.
>>>
>>> Now all your applescripts are in your single FileMaker file, and you can
>>> even do things like “tell application x” where “x” is a variable (FileMaker
>>> field).
>>
>> Could you please explain this in more detail? It sounds great, but I don’t
>> quite get how to do it.
>>
>>>
>>>
>>> Then there’s the ugly question of how to get data from your AppleScript
>>> back into FileMaker, but that’s another story
>>
>> Very often I set up a global field in FM that I can paste the Finder’s
>> clipboard into, then AppleScript just has to write the data to the clipboard
>> in a format that can be parsed by Filemaker. It’s just way easier IMHO than
>> trying to script FM directly from AS.
>>
>> Thanks.
>>
>>
>> Jim Weisbin | C.T.O. | Human | Post Human |
>>
>> Jim Weisbin | C.T.O. | Human | Post Human | 27 West 20th Street | Suite 801
>> | New York, NY | 10011 | (212) 352-0211 | (917) 375-2272 | 2046 Broadway |
>> Santa Monica, CA | 90404 | (310) 264-0211 telephone |
>> www.humanworldwide.com <http://www.humanworldwide.com/>
>> Click here <http://www.humanworldwide.com/#commercials> to view our online
>> reel
>>
>>
>> _______________________________________________
>> 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
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <https://lists.apple.com/mailman/private/applescript-users/attachments/20180625/6b7b5a85/attachment.html>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 25 Jun 2018 11:36:13 -0400
> From: Deivy Petrescu <email@hidden>
> To: AppleScript Users <email@hidden>
> Subject: Re: AppleScript script unable to respond to a script
> statement correctly
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
>
>
>> On Jun 25, 2018, at 05:41 , Nigel Garvey <email@hidden> wrote:
>>
>> <snip>
>>> probably faster then
>>> this.
>>
>> Surprisingly, no. There's no measurable difference, of course, when the
>> list only contains nine records as here. When it's extended to
>> seventy-two discrete records with 'ParagraphPosition' values covering
>> all the integers between 1 and 72, I get a pretty constant running time
>> of 0.024 seconds when the two lines are removed. It's the same whatever
>> the initial order of the records because the script has to do the same
>> amount of looping and comparing overall whatever happens.
>>
>> When the two lines are kept and RecList's length is reduced by 1 every
>> time, there are best- and worst-case scenarii. The best is when the
>> records are in the required order anyway. In this case the inner repeat
>> only ever examines the first record in the list as it exists at the
>> time. I get an overall running time of 0.002 seconds when this happens.
>> The worst case is when the initial order's the exact reverse of what's
>> required. In this case the inner loop has to examine every single
>> remaining record every time. Even so, the overall time I'm getting is
>> only 0.017 seconds — about two thirds of the time taken when the lines
>> are removed and the list isn't shortened. I've no idea why this should
>> be. :/
>>
>
> Actually my gut feeling was that it would be faster.
> But as you noticed it is much slower. The list with 1000 records ordered from
> the 9 up, took 91s with the 2 lines and 153 with the lines removed.
>
> I would risk to guess that this is due to the fact that the comparison is
> faster. But it goes against my intuition.
> However it is interesting,
>>> By the way, congrats on the victory :-)
>>
>> Thanks! :) But I have to admit that only four of our goals were due to
>> England's superior playing skills. The other two were from penalties
>> occasioned by the Panamanians' blatant and atrocious fouls! Fingers
>> crossed for when we meet the better teams ….
>>
>> NG
>
> That would be England and Belgium, which I am looking forward to watch.
>
> Deivy Petrescu
> email@hidden
>
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 25 Jun 2018 11:24:07 -0600
> From: David Crowe <email@hidden>
> To: Applescript Users <email@hidden>
> Cc: Jim Weisbin <email@hidden>
> Subject: Re: AppleScript with FileMaker
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Jim;
>
> You asked how to adapt software to run scripts that access “FileMaker Pro” or
> “FileMaker Pro Advanced”.
>
> This is difficult to do in AppleScript because you can’t just say:
>
> set FileMakerType to “FileMaker Pro Advanced”
> tell FileMakerType
> …
> end
>
> You have to arrange for the right dictionary, which I think is possible.
> However, it is much easier to do this from FileMaker, since it knows what it
> is, using the following to set a field (probably a global), upon opening your
> application to:
>
> If(
> LeftWords( Get(ApplicationVersion); 1 ) = "ProAdvanced";
> "FileMaker Pro Advanced";
> "FileMaker Pro"
> )
>
>
> Note that there are several other FileMaker application names (Server, xDBC
> etc) but you are probably only running scripts from either Pro or Pro
> Advanced (until Filemaker changes its naming conventions again).
>
> Now you can run a FileMaker script that encapsulates the AppleScript as such:
>
> Command: Set Field
> Field: g::AppleScript
> Value:
> "tell application \"" & g::FileMakerType & "\" to tell layout \"g\"¶
> tell first record¶
> set cell \"ScriptResult\" to path to documents folder as string¶
> end¶
> end tell"
> Command: Perform AppleScript
> Field: g::AppleScript
>
> The reason I write the applescript to a field before executing it is because
> the field contains the actual applescript that is going to be executed which,
> in this case is:
>
> tell application "FileMaker Pro Advanced" to tell layout "g"
> tell first record
> set cell "ScriptResult" to path to documents folder as string
> end tell
> end tell
>
> I pasted it into Smile to get the nice formatting. So, if I ran this from
> “FileMaker Pro” then the script would be changed accordingly before execution.
>
> Note that the FileMaker field “ScriptResult” may be a global, but the table
> “g” must have at least one record otherwise the script will fail. I usually
> set up a table called “g” in any of my applications, and make sure it has one
> record in it whenever the FileMaker application is opened.
>
> Finally, this illustrates how to write back the result of an AppleScript that
> is called from FileMaker. I think that this is more flexible and reliable
> than using the clipboard, since you can easily write different information
> into different fields, you can create new records, and whatever else you need
> to do.
>
> - David Crowe
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <https://lists.apple.com/mailman/private/applescript-users/attachments/20180625/06f9f7dd/attachment.html>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: signature.asc
> Type: application/pgp-signature
> Size: 833 bytes
> Desc: Message signed with OpenPGP using GPGMail
> URL:
> <https://lists.apple.com/mailman/private/applescript-users/attachments/20180625/06f9f7dd/attachment.bin>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 25 Jun 2018 13:27:11 -0400
> From: Jim Weisbin <email@hidden>
> To: David Crowe <email@hidden>
> Cc: Applescript Users <email@hidden>
> Subject: Re: AppleScript with FileMaker
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> This is brilliant - thanks!
>
>> On Jun 25, 2018, at 1:24 PM, David Crowe <email@hidden>
>> wrote:
>>
>> Jim;
>>
>> You asked how to adapt software to run scripts that access “FileMaker Pro”
>> or “FileMaker Pro Advanced”.
>>
>> This is difficult to do in AppleScript because you can’t just say:
>>
>> set FileMakerType to “FileMaker Pro Advanced”
>> tell FileMakerType
>> …
>> end
>>
>> You have to arrange for the right dictionary, which I think is possible.
>> However, it is much easier to do this from FileMaker, since it knows what it
>> is, using the following to set a field (probably a global), upon opening
>> your application to:
>>
>> If(
>> LeftWords( Get(ApplicationVersion); 1 ) = "ProAdvanced";
>> "FileMaker Pro Advanced";
>> "FileMaker Pro"
>> )
>>
>>
>> Note that there are several other FileMaker application names (Server, xDBC
>> etc) but you are probably only running scripts from either Pro or Pro
>> Advanced (until Filemaker changes its naming conventions again).
>>
>> Now you can run a FileMaker script that encapsulates the AppleScript as such:
>>
>> Command: Set Field
>> Field: g::AppleScript
>> Value:
>> "tell application \"" & g::FileMakerType & "\" to tell layout \"g\"¶
>> tell first record¶
>> set cell \"ScriptResult\" to path to documents folder as string¶
>> end¶
>> end tell"
>> Command: Perform AppleScript
>> Field: g::AppleScript
>>
>> The reason I write the applescript to a field before executing it is because
>> the field contains the actual applescript that is going to be executed
>> which, in this case is:
>>
>> tell application "FileMaker Pro Advanced" to tell layout "g"
>> tell first record
>> set cell "ScriptResult" to path to documents folder as string
>> end tell
>> end tell
>>
>> I pasted it into Smile to get the nice formatting. So, if I ran this from
>> “FileMaker Pro” then the script would be changed accordingly before
>> execution.
>>
>> Note that the FileMaker field “ScriptResult” may be a global, but the table
>> “g” must have at least one record otherwise the script will fail. I usually
>> set up a table called “g” in any of my applications, and make sure it has
>> one record in it whenever the FileMaker application is opened.
>>
>> Finally, this illustrates how to write back the result of an AppleScript
>> that is called from FileMaker. I think that this is more flexible and
>> reliable than using the clipboard, since you can easily write different
>> information into different fields, you can create new records, and whatever
>> else you need to do.
>>
>> - David Crowe
>
> Jim Weisbin | C.T.O. | Human | Post Human |
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <https://lists.apple.com/mailman/private/applescript-users/attachments/20180625/fb016aa0/attachment.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> AppleScript-Users mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/applescript-users
>
>
> ------------------------------
>
> End of AppleScript-Users Digest, Vol 15, Issue 139
> **************************************************
_______________________________________________
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