• 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: Is this possible in apple script? sed -e 's; \(.*/\).*; \1; | sed 's//share/HDA_DATA//Volumes/g'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this possible in apple script? sed -e 's; \(.*/\).*; \1; | sed 's//share/HDA_DATA//Volumes/g'


  • Subject: Re: Is this possible in apple script? sed -e 's; \(.*/\).*; \1; | sed 's//share/HDA_DATA//Volumes/g'
  • From: Vincent <email@hidden>
  • Date: Fri, 20 Dec 2013 08:13:51 +0400

Exactly what i want

Many thanks Thomas
bst regds
Vincent

On Dec 19, 2013, at 8:52 PM, email@hidden wrote:

Subject: Re: Is this possible in apple script? sed -e 's;\(.*/\).*;\1;
| sed 's//share/HDA_DATA//Volumes/g'
Message-ID: <99CD9F55-email@hidden>
Content-Type: text/plain; charset="windows-1252"

Hello Vincent,

I'm afraid that your script in general will not do what you want it to do, one of the reason being a confusion between words and text items.

E.g, try
/share/HDA DATA/Travaux/PAO/PAO ENCOURS/Travaux/127266/Jpg/Jpg/Logo.jpg
This will give an error with

set all to count word of PathToItem
set essai to all - 1
set Dest to text items 1 thru all of PathToItem
…

since there are more words than 1 + (the number of text items).
In general, note that … thru -1 will give you all respective elements without the need to count them first.

set AppleScript's text item delimiters to "/"
set PathToItem to the clipboard as string
set Dest to "/Volumes/" & (text items 4 thru -2 of PathToItem & "" as string)
tell application "System Events" to open Dest

will probably yield what you want (I don't fully understand your replacement at the front).
Note that in the given case the first text item is empty, thus you have to start with text item 4, and
that the '& ""' adds an empty item at the end of the previous list to create the slash at the end.

Best
Thomas

 _______________________________________________
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

  • Prev by Date: Re: Mail returns empty mailboxes in Mavericks
  • Next by Date: Rewriting Mach in AppleScript?!
  • Previous by thread: SmartRecord
  • Next by thread: Rewriting Mach in AppleScript?!
  • Index(es):
    • Date
    • Thread