Re: AppleScript-Users Digest, Vol 9, Issue 232
Re: AppleScript-Users Digest, Vol 9, Issue 232
- Subject: Re: AppleScript-Users Digest, Vol 9, Issue 232
- From: "email@hidden" <email@hidden>
- Date: Thu, 31 May 2012 03:19:30 +0800
发自我的 iPhone
在 2012-5-31,0:22,email@hidden 写道:
> 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. Using System Events rather than Finder (Lists)
> 2. Re: Using System Events rather than Finder (KOENIG Yvan)
> 3. Re: Using System Events rather than Finder (Shane Stanley)
> 4. Re: Using System Events rather than Finder (Lists)
> 5. FileMaker database access conflict (Marion Dickten)
> 6. Re: FileMaker database access conflict (Simon Forster)
> 7. Properties and Address Book Plug-Ins (Christian Boyce)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 29 May 2012 12:57:27 -0700
> From: Lists <email@hidden>
> To: Applescript Users List <email@hidden>
> Subject: Using System Events rather than Finder
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> Hi All. Last evening I was trying to rewrite some of my scripts that use the Finder to use System Events instead. Unfortunately the first command I picked to work with, duplicate, does not duplicate files as stated. Only after an hour or more of failures did I look on the net for answers. What I found (in this lists archive) was that the command doesn't seem to work for anyone.
>
> Rather than continuing to pound my head on the desk, could someone point me to a guide for scripting System Events to replace Finder (i.e. not GUI scripting)?
>
> Thanks
> Joe
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 29 May 2012 22:51:10 +0200
> From: KOENIG Yvan <email@hidden>
> To: liste AppleScript US <email@hidden>
> Subject: Re: Using System Events rather than Finder
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=iso-8859-1
>
>
> Le 29 mai 2012 à 21:57, Lists a écrit :
>
>> Hi All. Last evening I was trying to rewrite some of my scripts that use the Finder to use System Events instead. Unfortunately the first command I picked to work with, duplicate, does not duplicate files as stated. Only after an hour or more of failures did I look on the net for answers. What I found (in this lists archive) was that the command doesn't seem to work for anyone.
>>
>> Rather than continuing to pound my head on the desk, could someone point me to a guide for scripting System Events to replace Finder (i.e. not GUI scripting)?
>
> You may use Shane STANLEY's ASObjC Runner.app to replace some features missing in System Events.
>
> <http://www.macosxautomation.com/applescript/apps/runner_vanilla.html>
>
>
> Yvan KOENIG (VALLAURIS, France) mardi 29 mai 2012 22:51:03
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 30 May 2012 09:17:34 +1000
> From: Shane Stanley <email@hidden>
> To: liste AppleScript US <email@hidden>
> Subject: Re: Using System Events rather than Finder
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> On 30/05/2012, at 6:51 AM, KOENIG Yvan wrote:
>
>> You may use Shane STANLEY's ASObjC Runner.app to replace some features missing in System Events.
>
> And yet it lacks a direct duplicate command. I'm curious to know what the OP uses duplicate for.
>
> Anyway, it can be done like this:
>
> tell application "ASObjC Runner"
> manage file "Macintosh HD:Users:shane:Desktop:A test.plist" copying as "Macintosh HD:Users:shane:Desktop:A test copy.plist"
> end tell
>
> --
> Shane Stanley <email@hidden>
> 'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120530/5fb802e8/attachment.html>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 29 May 2012 18:22:25 -0700
> From: Lists <email@hidden>
> To: Shane Stanley <email@hidden>
> Cc: Applescript Users List <email@hidden>
> Subject: Re: Using System Events rather than Finder
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> On May 29, 2012, at 4:17 PM, Shane Stanley wrote:
>
>> On 30/05/2012, at 6:51 AM, KOENIG Yvan wrote:
>>
>>> You may use Shane STANLEY's ASObjC Runner.app to replace some features missing in System Events.
>>
>> And yet it lacks a direct duplicate command. I'm curious to know what the OP uses duplicate for.
>>
>
> Thanks for the suggestion. I wanted to replace the Finder duplicate command in a folder action script - more as an exercise than a need. I ended up using a do shell script cp command. Can't really tell if it is any faster. The FA is copying very large Photoshop files and the limiting factor seems to be disk speed.
>
> I'll work on System Events dictionary for a while longer. System Events is an app that I've tended to ignore.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120529/85afd7fb/attachment.html>
>
> ------------------------------
>
> Message: 5
> Date: Wed, 30 May 2012 09:38:45 +0200
> From: Marion Dickten <email@hidden>
> To: email@hidden
> Subject: FileMaker database access conflict
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> Hello,
>
> I am using AppleScripts to insert and delete records in a FileMaker database. Since this is a database other people access at the same time (remotely opened), we often run into access problems. Is there a way to create a database record that is locked for access except for the creating script? I have been thinking of transactions but what I've found by googling so far doesn't sound encouraging.
> (There are also some scripts created within FileMaker using FileMaker's own scripting language, and they give me the same problem.)
>
> Marion
>
>
> ------------------------------
>
> Message: 6
> Date: Wed, 30 May 2012 09:24:08 +0100
> From: Simon Forster <email@hidden>
> To: Marion Dickten <email@hidden>
> Cc: email@hidden
> Subject: Re: FileMaker database access conflict
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
>
> On 30 May 2012, at 08:38, Marion Dickten wrote:
>
>> I am using AppleScripts to insert and delete records in a FileMaker database. Since this is a database other people access at the same time (remotely opened), we often run into access problems. Is there a way to create a database record that is locked for access except for the creating script? I have been thinking of transactions but what I've found by googling so far doesn't sound encouraging.
>> (There are also some scripts created within FileMaker using FileMaker's own scripting language, and they give me the same problem.)
>
> Semi-random thoughts:
>
> - Are you using FileMaker Server to host the database? If not, this may help.
>
> - Are you creating the record via the script and then adding in data? Is this the problem? Have you tried creating the record with the data as a single action?
>
> - Can you not catch errors and retry?
>
> Simon
>
>
> ------------------------------
>
> Message: 7
> Date: Wed, 30 May 2012 09:21:59 -0700
> From: Christian Boyce <email@hidden>
> To: AS users <email@hidden>
> Subject: Properties and Address Book Plug-Ins
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Howdy. I've made a plug-in for Address Book that gives directions to whichever address is clicked on. It is better than the "Map this Address" because while Map this Address shows the selected address on a map, my plug-in gives directions to that address. Since the people I'm doing this for are using desktop Macs it is likely that they will never move, so once I set the "starting" address (via script) I don't want the user to have to choose his starting address again.
>
> The way I do it is I look at Address Book's "My Card" and give the user a list of all of the street addresses on it. When he chooses one of those addresses, that becomes the starting address. I save that in a property. The next time the user uses the plug-in the starting address is remembered, thanks to the property being set the first time, and that is exactly what I want. The problem is, if I quit Address Book, the property's value is forgotten, and the user has to set the starting address all over again.
>
> So, the property works the way I want it to until Address Book is quit and re-launched. That's what it boils down to. Is there a way to make the property survive across relaunches? I'd appreciate any help on this. This is my first time with Properties and maybe I'm doing something wrong. Thanks a lot.
>
> Here's the script. Put it into your /Library/Address Book Plug-Ins folder (saved as a script, scpt). You will have to restart Address Book for it to be an option (click on the label next to any street address to see the "* Map Directions To *" item, then choose it.)
>
> --by Christian Boyce, email@hidden. http://www.christianboyce.com
> --May 2012
>
> --
> property the_starting_point : ""
> using terms from application "Address Book"
> on action property
> return "address"
> end action property
> --
> on should enable action for theperson with theEntry
> if theEntry ≠ missing value then
> return true
> else
> return false
> end if
> end should enable action
>
> on action title for theperson with theEntry
> -- the string in the next line will appear when you click on an address' label in the Apple Address Book.
> return "* Map Directions To *"
> end action title
>
> on perform action for theperson with theEntry
>
> set the_addresses to {}
> try
> if the_starting_point is "" then
> set myaddresses to every address of my card
> repeat with an_address in myaddresses
> set address_string to street of an_address & ", " & city of an_address & ", " & state of an_address & " " & zip of an_address as string
> set clean_address_string to my stripReturns(address_string)
> set end of the_addresses to clean_address_string
> end repeat
> if (count of the_addresses) > 1 then
> set the_starting_point to choose from list the_addresses with prompt "Choose your starting point."
> set the_starting_point to the_starting_point as string
> display dialog "I'll remember that." buttons "OK" default button "OK"
> else
> set the_starting_point to item 1 of the_addresses as string
> display dialog "Since you only have one address on your Address Book card, I'll use it as the starting point." buttons "OK" default button "OK"
> end if
> if the_starting_point is not "false" then
> set the_starting_point to clean_it_up(the_starting_point)
> else
> set the_starting_point to ""
> display dialog "You canceled." buttons "OK" default button "OK"
> return
> end if
> end if
>
> on error
> display dialog "There's a problem. Be sure you have at least one address for yourself and that Address Book knows which card is yours."
> end try
>
> --
> set the_street to street of theEntry
> set cleanedStreet to clean_it_up(the_street)
>
> --
> set the_city to city of theEntry as string
> set cleanedCity to clean_it_up(the_city)
> --display dialog cleanedCity
> --
> set the_state to state of theEntry as string
> set cleanedState to clean_it_up(the_state)
> --
> set the_zip to zip of theEntry as string
> set cleanedZip to clean_it_up(the_zip)
> --
> set destinationAddress to cleanedStreet & ",+" & cleanedCity & ",+" & cleanedState & "+" & cleanedZip
> --make the URL
> set the_url to "http://maps.google.com/maps?saddr=" & the_starting_point & "&daddr=" & destinationAddress
>
> my OpenTheURL(the_url)
> end perform action
>
>
> on clean_it_up(some_string)
> set new_string to {}
> set some_string to every character of some_string
> set theCount to (count of some_string)
> repeat with i from 1 to theCount
> set the_character to item i of some_string as string
> if the_character is " " then
> set end of new_string to "+"
> else
> set end of new_string to the_character
> end if
> end repeat
> return new_string as string
> end clean_it_up
> --
>
> on OpenTheURL(some_url)
> tell application "Safari"
> activate
> set the_window to make new document
> set URL of the_window to some_url
> end tell
> end OpenTheURL
> --
> on stripReturns(some_string)
> set new_string to paragraph 1 of some_string
> set the_paragraphs to paragraphs of some_string
> if (count of the_paragraphs) is greater than 1 then
> repeat with i from 2 to count of the_paragraphs
> set new_string to new_string & " " & item i of the_paragraphs
> end repeat
> end if
> return new_string as string
> end stripReturns
> --
> end using terms from
>
> --
> Christian Boyce
> Christian Boyce and Associates
> Mac, iPhone, and iPad Consultants
> New Main Phone Number: 424-354-3548
>
> Read the Boyce Blog: http://christianboyce.blogspot.com
> Follow us on Twitter! http://twitter.com/christianboyce
> Be a fan on Facebook! http://tinyurl.com/cboyce-and-associates-facebook
>
> Now Playing on The Boyce Blog: Have Your iPhone and iPad Read Out Loud to You
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120530/8c376fc5/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> AppleScript-Users mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/applescript-users
>
> End of AppleScript-Users Digest, Vol 9, Issue 232
> *************************************************
_______________________________________________
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