Re: String manipulation
Re: String manipulation
- Subject: Re: String manipulation
- From: Iurista GmbH <email@hidden>
- Date: Fri, 07 Jun 2013 00:48:06 +0200
Am 07.06.2013 um 00.27 schrieb Christopher Stone:
> On Jun 06, 2013, at 16:36, Iurista GmbH <email@hidden> wrote:
>> I have Filenames in form of "some_text xx.xx.xx some_text", where xx.xx.xx is a date (german syntax: ie. 01.06.13 for the first of June)
>> I try to convert the "date part" into the form YYMMdd (ie. 130601).
>>
>> The tricky thing is to get the part "xx.xx.xx", which I highlight in Finder, to be copied.
>>
>> I managed to to this (in OSX 10.6.8)
> ______________________________________________________________________
>
> Hey Rudolf,
>
> I'm not sure about the delay where it is, but System Events can take a little while to launch if it's not running.
>
> Since you're on Snow Leopard you don't have to worry about the Lion/ML Finder-Selection bug.
>
> You're over-thinking the problem I think. :)
>
> Since you have the Satimage.osax try this: snip...snip...snip...
Thanks for that feedback, Christopher.
Unfortunately, this script does nothing at all :-(
Here's the results, step by step (the filename is "9.12.89 BUPO.cwk" extension is hidden)
tell application "Finder"
get selection
--> {alias "Ablage:ROD:B Adm:4 Behörden:f) Bupo:9.12.89 BUPO.cwk"}
join {alias "Ablage:ROD:B Adm:4 Behörden:f) Bupo:9.12.89 BUPO.cwk"} using "
"
--> error number -10004
end tell
tell application "AppleScript Editor"
join {alias "Ablage:ROD:B Adm:4 Behörden:f) Bupo:9.12.89 BUPO.cwk"} using "
"
--> "Ablage:ROD:B Adm:4 Behörden:f) Bupo:9.12.89 BUPO.cwk"
end tell
tell application "Finder"
change "^.+:" into "" in "Ablage:ROD:B Adm:4 Behörden:f) Bupo:9.12.89 BUPO.cwk" with regexp
--> error number -10004
end tell
tell application "AppleScript Editor"
change "^.+:" into "" in "Ablage:ROD:B Adm:4 Behörden:f) Bupo:9.12.89 BUPO.cwk" with regexp
--> "9.12.89 BUPO.cwk"
end tell
tell application "Finder"
change "(\\d{2})\\.(\\d{2})\\.(\\d{2})" into "\\3.\\2.\\1" in "9.12.89 BUPO.cwk" with regexp
--> error number -10004
end tell
tell application "AppleScript Editor"
change "(\\d{2})\\.(\\d{2})\\.(\\d{2})" into "\\3.\\2.\\1" in "9.12.89 BUPO.cwk" with regexp
--> "9.12.89 BUPO.cwk"
end tell
tell application "Finder"
splittext "9.12.89 BUPO.cwk" using "
"
--> error number -10004
end tell
tell application "AppleScript Editor"
splittext "9.12.89 BUPO.cwk" using "
"
--> {"9.12.89 BUPO.cwk"}
end tell
tell application "Finder"
set name of alias "Ablage:ROD:B Adm:4 Behörden:f) Bupo:9.12.89 BUPO.cwk" to "9.12.89 BUPO.cwk"
--> "9.12.89 BUPO.cwk"
end tell
Ergebnis:
"9.12.89 BUPO.cwk"
_______________________________________________
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