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.
Am 18.12.2013 um 21:03 schrieb Vincent: /share/HDA_DATA/Travaux/PAO/PAO_ENCOURS/Travaux/127266/Jpg/Jpg/Logo.jpg
set AppleScript's text item delimiters to "/" set PathToItem to the clipboard as string set all to count word of PathToItem set essai to all - 1 set Dest to text items 1 thru all of PathToItem set the clipboard to result as string set NextStep to the clipboard as string set AppleScript's text item delimiters to "/" set all2 to count word of NextStep set almostThere to words 3 thru all2 of NextStep set hereItIs to "/Volumes/" & almostThere do shell script "open " & hereItIs & ""
|