• 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: HD name change for X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HD name change for X


  • Subject: Re: HD name change for X
  • From: nino <email@hidden>
  • Date: Thu, 17 Jan 2002 17:15:17 +0100

> Once I do come up with the new name, is there an Applescript method of
> quickly changing my existing scripts which have "Mac Hard Drive" as part of
> filepaths, etc., so that they will incorporate the new name?
> Actually, the method does not have to be Applescript.

OK this is an old discussion item, but ...
I guess the question is how can you do it in Script Editor that is missing a
Find/Replace command. The only solution I know off it is to write a quite
simple script that does Find/Replace on the clipboard like:

repeat
set the_dialog_result to display dialog "Replace Script 1.0 Search and
replace text on the clipboard

Text to replace:" default answer "" buttons {"Cancel", "OK"} default button
2
set the_search_string to the text returned of the_dialog_result
if the_search_string is not "" then exit repeat
end repeat
display dialog "Replacement text:" default answer ""
set the_replacement_string to the text returned of the result
set the_text to the clipboard
set the_text to replace_chars(the_text, the_search_string,
the_replacement_string)
set the clipboard to the_text
beep 2
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars

A simple command-A, command-C (select all, copy), run your script, command-V
(paste) sequence will do the job. Osa Menu or similar script launcher can
help. If you need case sensitive search just change the replacement metod.

nino


  • Prev by Date: RE: HTML query
  • Next by Date: Re: Archiving large folders to CD
  • Previous by thread: Re: HD name change for X
  • Next by thread: Re: HD name change for X
  • Index(es):
    • Date
    • Thread