Re: String manipulation
Re: String manipulation
- Subject: Re: String manipulation
- From: Emmanuel LEVY <email@hidden>
- Date: Fri, 07 Jun 2013 10:24:43 +0200
> I also see there's a bug in the Satimage.osax when joining single-item lists. I've worked around that too.
huh?
what do you mean, a bug?
Best,
Emmanuel
On Jun 7, 2013, at 8:48 AM, Christopher Stone wrote:
> On Jun 06, 2013, at 17:48, Iurista GmbH <email@hidden> wrote:
>> Thanks for that feedback, Christopher.
>> Unfortunately, this script does nothing at all :-(
> ______________________________________________________________________
>
> Hey Rudolf,
>
> Hmm...
>
> Okay. The feedback you sent shows that you have some dates that are not of the form dd.mm.yy but of the form d.mm.yy, so that means you might have some that are d.m.yy. That makes a difference, and Thomas' regex is a pretty good way to handle it.
>
> I also didn't notice the first time around that you didn't want to retain the '.' separators. I fixed this in the script below. It now produces 130601 for the date instead of 13.06.01
>
> I also see there's a bug in the Satimage.osax when joining single-item lists. I've worked around that too.
>
>> Here's the results, step by step (the filename is "9.12.89 BUPO.cwk" extension is hidden)
>
> Okay. I've made you a movie (available for a week from today):
>
> The movie is slightly off, because I made it before noticing the regex needed to be changed - but hopefully it will still be of value.
>
> Let me know if you still have problems.
>
> --
> Best Regards,
> Chris
>
> -------------------------------------------------------------------------------------------
>
> try
>
> tell application "Finder"
>
> set theFinderSelection to selection as alias list
>
> if length of theFinderSelection ≥ 1 then
> set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, linefeed}
> set pathList to theFinderSelection as text
> set AppleScript's text item delimiters to oldTIDS
> set nameList to change "^.+:" into "" in pathList with regexp
> set nameList to change "(\\d{1,2})\\.(\\d{1,2})\\.(\\d{1,2})" into "0\\3.0\\2.0\\1" in nameList with regexp
> set nameList to change "\\d?(\\d\\d)\\.\\d?(\\d\\d).\\d?(\\d\\d)" into "\\1\\2\\3" in nameList with regexp
> set nameList to splittext nameList using linefeed
>
> repeat with i from 1 to (length of theFinderSelection)
> set name of item i of theFinderSelection to item i of nameList
> end repeat
>
> else
> error "No items were selected in the Finder!"
> end if
>
> end tell
>
> on error e number n
> set e to e & return & return & "Num: " & n
> tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
> if button returned of dDlg = "Copy" then set the clipboard to e
> end try
>
> -------------------------------------------------------------------------------------------
>
> _______________________________________________
> 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
_______________________________________________
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