Re: Positioning Items on the Desktop
Re: Positioning Items on the Desktop
- Subject: Re: Positioning Items on the Desktop
- From: Nigel Garvey <email@hidden>
- Date: Fri, 25 Oct 2013 13:56:20 +0100
Shane Stanley wrote on Fri, 25 Oct 2013 13:19:38 +1100:
>On 25 Oct 2013, at 12:19 PM, Christopher Stone
><email@hidden> wrote:
>> Anyway I thought I'd pass this one along.
>
>OK, let's assume for a moment you couldn't use Satimage.osax. And let's
>assume you don't even want to use regular expressions (I can hear you
>screaming now).
>
>Let's further assume you find using "run script" inside a Finder tell
>block to make a list somewhat, well, distasteful ;-)
On the other hand, if we assume that the exact opposites are still true
;), Chris could massage his text into a full script which would only
require one 'run script' execution:
set desktopPositionList to change "[[:space:]]+$" into "" in desktopPositionList with regexp
set desktopPositionList to change "\"" into "\\\"" in desktopPositionList
set desktopPositionList to change "^(.+[^[:blank:]])[[:blank:]]{3,}(.+)$" into "try\\rset desktop position of item \"\\1\" to \\2\\rend" in desktopPositionList with regexp
set desktopPositionList to change "^(.+)$" into "tell app \"Finder\"\\r\\1\\rend" in desktopPositionList regexpflag {"MULTILINE"} with regexp
run script desktopPositionList
Or, of course:
run script (do shell script "sed -En '
1 a\\'$'\\n''tell app \"Finder\"
/^[[:space:]]*$/ !{
s/\\\"/\\\\\\\"/g
s/^(.+[^[:blank:]])[[:blank:]]{3,}(.+)$/try\\'$'\\n''set desktop position of item \"\\1\" to \\2\\'$'\\n''end/p
}
$ a\\'$'\\n''end' <<<" & quoted form of desktopPositionList)
It's probably possible to use "osascript" in the shell script rather
than 'run script' after it, but then I'd have to set up my desktop to
test it. ;)
NG
_______________________________________________
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