• 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: Find/replace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find/replace


  • Subject: Re: Find/replace
  • From: Tim Mansour <email@hidden>
  • Date: Thu, 20 Aug 2009 08:37:34 +1000

Robert, in your code I'm not sure what createList is doing but is your
intention to actually rename the files on disk, or are you merely
creating a list of file names with "illegal" characters removed? This
looks different to your OP about removing the first 5 characters.

It's often easier to post an entire script so we can see exactly what
you're trying to achieve.

2009/8/20 Robert Poland <email@hidden>:
> Hi,
> I appreciate the help everyone has offered.
> Here's the source of my confusion. A little flashback;
> My current script uses these elements;
> property searchStrings : {",", "'", " ", "&", "#", "__"}
> property replacementStrings : {"_", "", "_", "_and_", "_", "_"}
> ...
> on FindReplaceIllegalChar(droppedItems)
> tell application "Finder"
> set source_folder to droppedItems
> repeat with x from 1 to (get count of items in searchStrings)
> set search_string to (item x of searchStrings)
> set replacement_string to (item x of replacementStrings)
> my createList(source_folder)
> end repeat
> end tell
> end FindReplaceIllegalChar
> changing to:
> property searchStrings : {"^00[0-9]{2}_"}
> property replacementStrings : {""}
> Didn't seem to be the answer.
>
> On Aug 19, 2009, at 6:13 AM, Tim Mansour wrote:
>
> 2009/8/19 Robert Poland <email@hidden>:
>
> Apparently "fname regexp true" is important but I don't know how to add
>
> that.
>
> I probably didn't explain that well enough. Assuming you have the
> Satimage.osax scripting addition installed, you can use its "change"
> command to get rid of those first characters, which I assumed were in
> fact two zeros followed by 2 other digits followed by an underscore.
> So an entire script might look something like this:
>
> property searchString : "^00[0-9]{2}_"
> property replacementString : ""
>
> set file_path to (choose file) as text
> tell application "System Events"
> set file_info to (properties of file file_path)
> set name of file file_path to change searchString into
> replacementString in name of file_info with regexp
> end tell
>
> --
> Tim Mansour <email@hidden>
> Neologica Print & Promotions (ABN 63 904 335 408)
> Certified FileMaker 10 Developer
> 159 Commonwealth Street : Surry Hills NSW 2010 : Australia
> Mobile 0405 500 846 : Sydney 02 9043 3223 : Melbourne 03 9012 7441
>
>
> Bob Poland - Fort Collins, CO
>
>
>



--
Tim Mansour <email@hidden>
Neologica Print & Promotions (ABN 63 904 335 408)
Certified FileMaker 10 Developer
159 Commonwealth Street : Surry Hills NSW 2010 : Australia
Mobile 0405 500 846 : Sydney 02 9043 3223 : Melbourne 03 9012 7441
 _______________________________________________
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

References: 
 >Find/replace (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Unable to send user input string to Webster Dictionary Application using variable
  • Next by Date: System Events duplicate command
  • Previous by thread: Re: Find/replace
  • Next by thread: Launchd Problems
  • Index(es):
    • Date
    • Thread