• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Positioning Items on the Desktop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Positioning Items on the Desktop
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: Applescript complaining about accessing and writing to a file
  • Next by Date: Scripting Pages
  • Previous by thread: Re: Positioning Items on the Desktop
  • Next by thread: Re: Positioning Items on the Desktop
  • Index(es):
    • Date
    • Thread