Re: can this be simplified?
Re: can this be simplified?
- Subject: Re: can this be simplified?
- From: Vincent <email@hidden>
- Date: Tue, 3 Aug 2010 19:23:34 +0400
yours is best ;) :)
i must hav a good look at sed.
many thx
;)
On 03 Aug 2010, at 19:10, Mark J. Reed wrote:
So what was wrong with my one-line solutions? :)
On Tue, Aug 3, 2010 at 10:57 AM, Vincent <email@hidden> wrote:
> Ok after goooglling get it really very simple from 27 lines to 12:
> set JobBagName to (the clipboard as text)
> set AppleScript's text item delimiters to {" ", ".", ":", ";", "-", ",",
> "(", ")", "'"}
> set AppleScript's text item delimiters to {"_"}
> set JobBagName to "" & words of JobBagName
> set userChoice to display dialog "Name of New Job Bag - Nouveau Dossier"
> default answer JobBagName buttons {"OK", "Cancel"} default button 1
> set JobBagFinalName to text returned of userChoice
> set destination to choose folder with prompt "Select Folder for Job Folder
> Creation - Destination du Nouveau Dossier"
> tell application "Finder"
> set TheNewJobBag to make new folder with properties {name:JobBagFinalName}
> at destination
> make folder with properties {name:"SourcesClient_" & JobBagFinalName} at
> TheNewJobBag
> open TheNewJobBag
> end tell
>
>
> On 03 Aug 2010, at 08:03, email@hidden wrote:
>
>
>
> set AppleScript's text item delimiters to {"___"}
> set new to text items of newName
> in my original script, why doesnt it replace the 3 _ _ _ in the above pass?
>
> This is why we were wondering what your input looked like.
>
> Here's what's happening in your script. All cases where those items in your
> list occur are replaced by "_"
> In the text that results, there may be cases where there are 2 , 3 or more
> "_" in a row.
> Hello__World___How_are_You_____I_am_Fine
> The next command replaces all the cases where there are 3 in a row with 1.
> Hello__World_How_are_You___I_am_Fine
> Where there were 5 in a row (after the word 'you') it would replace the
> first 3 with one, leaving you with 3 in a row.
> Then your script would replace 2 in a row, with one, leaving your with three
> in a row in that one case.
> Hello_World_How_are_You__I_am_Fine
> HTH,
> ES
> W
>
> dd
>
>
> _______________________________________________
> 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
>
--
Mark J. Reed <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