Find and Replace across multiple topics
I haven't used RoboHTML in a few years and am getting back to using it again. this is a fairly simple question, but the Help for RoboHelp doesn't seem to provide an answer.
How do you do a simple find and replace across multiple topics? I want to search for a text string and replace it with another text string.
Hi,
Have you tried to use the "Multiple File Find and Replace" option present in RoboHelp. You may access this option from Edit->Find and Replace in Files.
Before trying to find the files, please ensure that the where field in the dialog points to the correct location of your project.
Thanks
Similar Messages
-
Find and Replace Across Multiple Sites
Hi,
Just wondering if anyone knows a way or a piece of software
that enables you
to Find and Replace code, text etc across multiple sites?
I am using DWMX2004 and I can do it on a per site basis but
not multiple
sites at once.
Any idea's???
Thanks
Darrell....Alan wrote:
> IF these dreamweaver sites are all in a common folder,
like
> sites:siteA and sites:siteB and so on- You could make a
new dw site that
> has the common root folder "sites" as it's Local folder.
Find and Replace
> sitewide while in that site would effect all the files
within the defined
> folder.
You don't have to define a site, Blue, just select a folder
to search.
Mick
>
> also, other text editors have good find and replace
features.
>
> back up, back up, and then make another back up copy.
>
> If working with links in this "super site" definition-
be aware of the
> possible problems of defining a site where the root
isn't the real root.
>
>
>>Just wondering if anyone knows a way or a piece of
software that enables you
>>to Find and Replace code, text etc across multiple
sites?
>
>
> -
Find and Replace across multiple PDF files
Hello,
The company I work for has recently changed it's name from (for example!) "Rob's Company" to "Dave's Company".
I have a folder with several thousand PDF files where "Rob's Company" is mentioned and I want to find/replace this for "Dave's Company" in one job (as opposed to opening each file and doing a find/replace in each one).
I am happy to purchase a copy of Adobe Acrobat in order to do this, but I'm unsure if it is capable of doing so. I know it is possible to do this for individual files, but not sure that it can do a find/replace for all files in a particular folder.
I hope someone is able to assist me, I'd be very grateful.
Best wishes,
RobI totally agree with you regarding keeping the source files; it's common sense isn't it! I've only worked at this company for 14 days and the vast majority of docs are years old so it would be nearly impossible to trace back the owner of the document internally and then for who their contact is at the client who originally sent it over. With staff turnover you'd probably get nowhere pretty slowly!
Thanks very much for your redact suggestion. Is that basically where you "stick" new text over the old? The phrases to be changed are reasonably simalar in length (new text is 1 character smaller) so if there was a small gap at the end of the phrase I wouldn't loose sleep over it.
Thanks again for your help - as I say with just 14 days in the company it would be nice to get this job done without involving too many people so it looks good to my new bosses!
Rob -
Find and replace with multiple files and with a watch folder
I am trying to create a watch folder that uses red_menace script to:
1. Have a folder that receives multiple xml files that run the script one by one.
2. then move the files to an output folder.
I tried modifying the set TheFIle to choose file -- the original text file to:
with multiple selections allowed
But that doesn't seem to work. I know i'm missing a step. Any help is much appreciated!
Thanks!
The way i'd like to setup things is having an input folder on the desktop (or just have the application on the desktop and I can drag the files onto it), and let it do it's thing. Once it's done have it export the xml files into an output folder.
Here's what i got so far:
on open
set TheFIle to choose file -- the original text file
set TheFolder to ("Macintosh HD:Users:user1:Desktop:out") -- the folder for the output file
set TheName to (GetUniqueName for TheFIle from TheFolder) -- the name for the output file
set TheText to read TheFIle -- get the text to edit
set Originals to {"KPCALDATE", "KPCALEVENT", "KPCALDAY", "KPCALBODY", "obituaries name", "" & return & "</cstyle></pstyle>" & return & "<pstyle name=\"obituaries text\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>", " .com", " .net", " .org", " .edu", "www .", "www. ", "Ho- nolulu", "<pstyle name=\"kicker 12\"><cstyle allcaps=\"1\">fashion news</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "<component name=\"Headline 1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline 1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 36\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>-", "-", "
Per serving:", "<pstyle name=\"Titlebar - mini, red\"><cstyle allcaps=\"1\">NATION & World </cstyle><cstyle allcaps=\"1\">Report</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "</cstyle></pstyle>"} -- the terms that can be replaced
set Replacements to {"subhed", "subhed", "subhed", "Normal", "obituaries text", ", ", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>
", ".com", ".net", ".org", ".edu", "www.", "www.", "Honolulu", "", "<component name=\"Headline1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 27\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>", " ", "
Per serving:", "","" & return & "</cstyle></pstyle>"} -- the replacement terms
repeat with AnItem from 1 to count Originals
set TheText to (replaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
end repeat
try -- write a new output file
tell application "Finder" to make new file at TheFolder with properties {name:TheName}
set OpenFile to open for access (result as alias) with write permission
write TheText to OpenFile starting at eof
close access OpenFile
on error errmess
try
log errmess
close access OpenFile
end try
end try
end open
to GetUniqueName for SomeFile from SomeFolder
check if SomeFile exists in SomeFolder, creating a new unique name if needed
parameters - SomeFile [mixed]: a source file path
SomeFolder [mixed]: a folder to check
returns [text]: a unique file name and extension
set {Counter, Divider} to {"00", "_"}
-- get the name and extension
set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
if TheExtension is missing value then set TheExtension to ""
set TheName to text 1 thru -((count TheExtension) + 2) of TheName
set NewName to TheName & "." & TheExtension
tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
repeat while it contains NewName
set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
set NewName to TheName & Divider & Counter & "." & TheExtension
end repeat
end tell
return NewName
end GetUniqueName
to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
displays a dialog for multiple item edit (note that a return is used between each edit item)
for each of the items in SomeItems, a line containing it's text is placed in the edit box
the number of items returned are padded or truncated to match the number of items in SomeItems
parameters - SomeItems [list]: a list of text items to edit
TheTitle [boolean/text]: use a default or the given dialog title
ThePrompt [boolean/text]: use a default or the given prompt text
returns [list]: a list of the edited items, or {} if error
set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
if TheCount is less than 1 then return {} -- error
if ThePrompt is in {true, false} then -- "with" or "without" Prompt
if ThePrompt then
set ThePrompt to "Edit the following items:" & return -- default
else
set ThePrompt to ""
end if
else -- fix up the given prompt a little
set ThePrompt to ThePrompt & return
end if
if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
set TheTitle to "Multiple Edit Dialog" -- default
else
set TheTitle to ""
end if
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
repeat with AnItem from 1 to TheCount -- pad/truncate entered items
try
set the end of TheItems to (item AnItem of TheInput)
on error
set the end of TheItems to ""
end try
end repeat
return TheItems
end EditItems
to replaceText of SomeText from OldItem to NewItem
replace all occurances of OldItem with NewItem
parameters - SomeText [text]: the text containing the item(s) to change
OldItem [text]: the item to be replaced
NewItem [text]: the item to replace with
returns [text]: the text with the item(s) replaced
set SomeText to SomeText as Unicode text -- TID's are case insensitive with Unicode text
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
return SomeText
end replaceText
Message was edited by: gamebreakersWhen you use the open or adding folder items to handlers, you need to add the parameters for the file items passed to them.
I'll go ahead and post the applet/droplet version of my original script from the previous topic for reference:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
-- search and replace multiple items applet/droplet/folder action
-- the terms to replace - edit as needed
property EditableItems : {¬
"one", ¬
"two", ¬
"three", ¬
"four", ¬
"five", ¬
"six", ¬
"seven", ¬
"eight", ¬
"nine", ¬
"ten", ¬
"eleven", ¬
"twelve", ¬
"thirteen", ¬
"fourteen", ¬
"fifteen", ¬
"sixteen", ¬
"seventeen", ¬
"eighteen", ¬
"nineteen", ¬
"twenty"}
-- the folder for the output file(s) - change as needed
property TheFolder : (path to desktop)
property LastEditItems : EditableItems
on run
the applet/droplet was double-clicked
open (choose file with multiple selections allowed)
end run
on open TheItems
items were dropped onto the applet/droplet
parameters - TheItems [list]: a list of the items (aliases) dropped
returns nothing
repeat with AnItem in TheItems
ReplaceMultipleItems from AnItem
end repeat
end open
on adding folder items to this_folder after receiving these_items
folder action - items were added to a folder
parameters - this_folder [alias]: the folder added to
these_items [list]: a list if items (aliases) added
returns nothing
repeat with AnItem in these_items
ReplaceMultipleItems from AnItem
end repeat
end adding folder items to
to ReplaceMultipleItems from SomeFile
replace multiple text items in SomeFile
parameters - SomeFile [alias]: the file to replace items in
returns nothing
set TheName to (GetUniqueName for SomeFile from TheFolder) -- the name for the output file
set TheText to read SomeFile -- get the text to edit
set Originals to (choose from list EditableItems default items LastEditItems with prompt "Select the terms to replace:" with multiple selections allowed) -- the specific terms to replace
set LastEditItems to Originals
set Replacements to (EditItems of Originals with Title given Prompt:"Edit the following replacement terms:") -- the replacement terms
repeat with AnItem from 1 to count Originals
set TheText to (ReplaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
end repeat
try -- write a new output file
tell application "Finder" to make new file at TheFolder with properties {name:TheName}
set OpenFile to open for access (result as alias) with write permission
write TheText to OpenFile starting at eof
close access OpenFile
on error errmess
try
log errmess
close access OpenFile
end try
end try
end ReplaceMultipleItems
to GetUniqueName for SomeFile from SomeFolder
check if SomeFile exists in SomeFolder, creating a new unique name if needed
parameters - SomeFile [mixed]: a source file path
SomeFolder [mixed]: a folder to check
returns [text]: a unique file name and extension
set {Counter, Divider} to {"00", "_"}
-- get the name and extension
set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
if TheExtension is in {missing value, ""} then
set TheExtension to ""
else
set TheExtension to "." & TheExtension
end if
set {NewName, TheExtension} to {TheName, (ChangeCase of TheExtension to "upper")}
set TheName to text 1 thru -((count TheExtension) + 1) of TheName
tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
repeat while it contains NewName
set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
set NewName to TheName & Divider & Counter & TheExtension
end repeat
end tell
return NewName
end GetUniqueName
to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
displays a dialog for multiple item edit (note that a return is used between each edit item)
for each of the items in SomeItems, a line containing it's text is placed in the edit box
the number of items returned are padded or truncated to match the number of items in SomeItems
parameters - SomeItems [list]: a list of text items to edit
TheTitle [boolean/text]: use a default or the given dialog title
ThePrompt [boolean/text]: use a default or the given prompt text
returns [list]: a list of the edited items, or {} if error
set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
if TheCount is less than 1 then return {} -- error
if ThePrompt is in {true, false} then -- "with" or "without" Prompt
if ThePrompt then
set ThePrompt to "Edit the following items:" & return -- default
else
set ThePrompt to ""
end if
else -- fix up the given prompt a little
set ThePrompt to ThePrompt & return
end if
if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
set TheTitle to "Multiple Edit Dialog" -- default
else
set TheTitle to ""
end if
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
repeat with AnItem from 1 to TheCount -- pad/truncate entered items
try
set the end of TheItems to (item AnItem of TheInput)
on error
set the end of TheItems to ""
end try
end repeat
return TheItems
end EditItems
to ReplaceText of SomeText from OldItem to NewItem
replace all occurances of OldItem with NewItem
parameters - SomeText [text]: the text containing the item(s) to change
OldItem [text]: the item to be replaced
NewItem [text]: the item to replace with
returns [text]: the text with the item(s) replaced
set SomeText to SomeText as text
if SomeText contains OldItem then
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
try
set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
on error ErrorMessage number ErrorNumber -- oops
set AppleScript's text item delimiters to TempTID
error ErrorMessage number ErrorNumber
end try
end if
return SomeText
end ReplaceText
to ChangeCase of SomeText to CaseType
changes the case or capitalization of SomeText to the specified CaseType using Python
parameters - SomeText [text]: the text to change
CaseType [text]: the type of case desired:
"upper" = all uppercase text
"lower" = all lowercase text
"title" = uppercase character at start of each word, otherwise lowercase
"capitalize" = capitalize the first character of the text, otherwise lowercase
returns [text]: the changed text
set SomeText to SomeText as text
if CaseType is not in {"upper", "lower", "title", "capitalize"} then return SomeText
return (do shell script "/usr/bin/python -c \"import sys; print unicode(sys.argv[1], 'utf8')." & CaseType & "().encode('utf8')\" " & quoted form of SomeText)
end ChangeCase
</pre>
Edit: how does the choose from list dialog handle those big strings? I'm guessing not very well - is that why you avoided using them?
Message was edited by: red_menace -
Find and replace for multiple thin space with enter...
Hi,
Im new to the InDesign Scripting. I need to replace multiple thin space with enter to single enter. Dont know how to do. Pls someone help me.
Thanks in advance,
SudhaHi Sudha,
Use the Sample code,
app.findTextPreferences = null;
app.changeTextPreferences = null;
app.findChangeTextOptions.wholeWord = false;
app.findChangeTextOptions.caseSensitive = true;
app.findChangeTextOptions.includeMasterPages = false;
app.findTextPreferences.findWhat = "<2009>^p";
app.documents.item(0).findText();
app.changeTextPreferences.changeTo = "^p";
app.documents.item(0).changeText();
app.findTextPreferences = null;
app.changeTextPreferences = null;
Regards,
Nagaraj -
In Edge Code can i do a find and replace?
In Edge Code can i do a find and replace on multiple lines of code or just a single line?
You can't do it on just one type of file. However, you can do find and replace in selected files. Ctrl-click to select the targeted files in the Files panel, and then choose Selected Files in Site from the Find In drop-down.
-
How do I create a multiple find and replace for Excel in AppleScript?
I have a large dataset in Excel that I have to do a multiple find/replace in (changing USPS state abbreviations to their full names). In searching the Microsoft boards--I was directed to use Applescript, and even the documented help with Excel was recommeding this. Unfortunately, there wasn't much help potinting me in the specific direction I needed. Any ideas on how I should write this script?
Thanks!I'm confused as to why Applescript (or any script would be helpful).
You'd have to type the abbreviation and the full name into the script, the same as just using Find and Replace All. You wouldn't gain anything by using a script. Is there more to this task than you've let on?
MacTech has an article on converting from VBA to Applescript, but I'm not sure if it would have any ideas on your specific problem: http://www.mactech.com/vba-transition-guide/index-toc.html -
How to find and replace multiple cells at a time
I am doing repetitive work re find text in numbers but then replace following cells with text. How can I find and replace multiple cells at a time?
i.e. doing my own budget spreadsheet and coding all transactions with description and codeDid you try the "Find/Replace" dialog box?:
Then click the "Replace All" button in the bottom left. -
Find and Replace Font Colors in Multiple Text Boxes
Hello,
I have Illustrator version 15
I made many text boxes with multiple colors, red and black on each letter. I was wondering if there is a find and replace tool for multiple text boxes. I want to change the reds to black and the blacks to light grey. I tried clicking on change swatch color but it only worked for the letter I had selected, even with the global option selected. I then when to select -> Same -> Color Stroke but it just selected each text box on the page....Is there anyway to do this?
JordanNot exactly a find and replace but you can do it.
Select the text frames yu want to change the colors using the shift key to click select the frames.
Then go to Edit>Edit Color>Recolor Art
You wll see a dialog with red and black bars along side two shorter bars click the shorter bars to select a New Color a color picker will appear you can use the swatches or the color mixer.
There is a live preview /so you will see the change in case you want to pick a different gray, of course you can always go back to the recolor art dialog.
I am afraid you manually have to select text frames with multiple colors in order to accomplish what you want but the method above I believe is the only want to change the colors.
This video shows how the dialog works but pretend the one frame I did not select is another color.
http://www.wadezimmerman.com/videos/RecolorText.mov -
Search Bar/Find and Replace Syncing Across Apps
It would appear that my find-and-replace search boxes are syncing across apps (and also the Safari search bar).
1. Open TextEdit, press ⌘F, enter something to search for, say 'test"
2. Open another app, say Sublime Text or Safari. Press ⌘F. The search field is magically populated with "test"!
Same thing happens if I start in Safari, and use the URL bar to search for something, then open TextEdit and press ⌘F.
This is driving me crazy. Does anyone know how to turn it off?
Running OS X 10.9.4 with all updates installed - it seems to be an OS X default thing.I don't see it in Safari unless I actually use Command F to search. You should use Command L in the URL bar to start a new search.
-
How can I multi-find and replace relative paths to external topics?
I am using RH7 and publishing to a company server share. External topics are saved on the same server share and linked on my local drive to create a relative link. How can I do a multi-find and replace on the relative links to change the path to the external docs? The paths do not show up in the Topics List because they are relative, not absolute. Although changing all of the many paths manually would be job security, I would like an easier fix. Thanks for any help.
Hello again
Likely your best bet at this point is to use a good Multi-File Find and Replace utility.
While RoboHelp has one included, it often fails. So we typically recommend something like FAR (Find And Replace) or BKReplace.
Click here to visit the FAR site
Click here to visit the page for BKReplace
Cheers... Rick
Helpful and Handy Links
RoboHelp Wish Form/Bug Reporting Form
Begin learning RoboHelp HTML 7, 8 or 9 within the day!
Adobe Certified RoboHelp HTML Training
SorcerStone Blog
RoboHelp eBooks -
Find and Replace multiple line PHP comment
Greeting everyone!
Hopefully this question is asked in the right place.
I have about 300 php files that have multiple line PHP
comment that start with /* and end with this */. I want to remove
all the comments since I am trying to reduce the file size as much
as possible. The comments are no longer needed and I have tried
many different configureation in the dreamweaver find and replace,
but for the life of me I cannot seem to get it to work. I even
tried useing regular expressions, but the astrick * is a wild card
the the code tags contain an astrick.
Is it possible to do this in dreamweaver, or will I need to
hand edit every page?
Thank for help
exampleI am not sure of the exact syntax but open the find replace
function on a page and play with find syntax search feature from
the drop down menu . If I am not mistaken you should be able to to
search from the beginning of a comment tag to the end of one and
grab whats in between. From the help file
Use the Find And Replace dialog box to search for text or
tags in a document, and to replace the found material with other
text or tags.
Select Edit > Find And Replace.
In the Search pop‑up menu, select Specific Tag.
Select a specific tag or [any tag] from the pop‑up menu
next to the Search pop‑up menu, or type a tag name in the
text box.
(Optional.) Limit the search with one of the following tag
modifiers:
With Attribute Specifies an attribute that must be in the tag
for it to match. You can specify a particular value for the
attribute or select [any value].
Without Attribute Selects an attribute that must not be in
the tag for it to match. For example, select this option to search
for all img tags with no alt attribute.
Containing Specifies text or a tag that must be contained
within the original tag for it to match. For example, in the code
<b><font size="4">heading 1</font></b>, the
font tag is contained within the b tag.
Not Containing Specifies text or a tag that must not be
contained within the original tag for it to match.
Inside Tag Specifies a tag that the target tag must be
contained in for it to match.
Not Inside Tag Specifies a tag that the target tag must not
be contained in for it to match.
(Optional.) To limit the search further, click the Plus (+)
button and repeat step 3.
If you didn’t apply any tag modifiers in steps 3 and 4,
then click the Minus (-) button to remove the tag modifiers
pop‑up menu.
If you want to perform an action when the tag is found (such
as removing or replacing the tag), select the action from the
Action pop‑up menu and, if applicable, specify any additional
information necessary to perform the action. -
Find and replace help needed, multiple variables
Hi everyone,
Im trying to find all urls in my code that start in a particular way but have a number variable at the end, see examples below
<a href="/example/examplefolder/enquiry.asp?pid=123">
<a href="/example/examplefolder/enquiry.asp?pid=485">
<a href="/example/examplefolder/enquiry.asp?pid=284">
and replace them with one url, see example below
<a href="/example/examplefolder/default.asp">
How can I use Dreamweaver find and replace to achieve this across my whole website?
So far I only know how to find one thing and replace with another, rather than finding variables and replacing them with one thing.
Thanks for your help with this!In the Find field of the Find and Replace dialog box, enter this:
(href\s*=\s*\"\/example\/examplefolder\/enquiry\.asp)\?pid=\d+(\")
In the Replace field, enter this:
$1$2
Select the "Use regular expression" checkbox.
Explanation:
The two sets of parentheses are capturing groups, which capture the actual values as $1 and $2.
The \s* matches zero or more spaces.
\" matches a double quote.
\/ matches a forward slash.
\? matches a question mark
\d+ matches one or more numbers.
I have written a two-part tutorial on using regular expressions, which can be found here: http://www.adobe.com/devnet/dreamweaver/articles/regular_expressions_pt1.html.
Message was edited by: David_Powers (adding explanation of double quote). -
Batch Edit Multiple HTML files | Find and Replace
Hi,
I would like to use Automator to automate (I know that sounds redundant) the following process.
1. Take a group of html files
2. Open each file so it can find and replace the script of any image folders
Example:
Change: img src="home_files/photo.jpg" to img src="images/photo.jpg"
3. Save & Close each file
I assume this this would have to be done in either AppleScript or Cocoa.
Any help would be greatly appreciated.
Thanks in advance.you most definitely don't need Cocoa for something like that. if all you need is a straightforward search and replace in a bunch of html files you can easily do this with a shell script. If you need some more involved search and replace you have to explain what it is exactly that you want.
to automate direct search and replace you can do something along the following lines in automator
1. get selected finder items (this will select your html files)
2. run shell script action with input passed as arguments
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
for f in "$@"
do
fl=`echo "$f"`
sed 's%home_files/photo.jpg%images/photo.jpg%g' $f > /users/$USER/.tmp.txt
cat /users/$USER/.tmp.txt > "$fl"
done
rm /users/$USER/.tmp.txt</pre> -
Find and replace text in multiple Photoshop files?
Hi there,
Let us say I have six Photoshop files: 1.psd, 2.psd, ..., 6.psd. All of these files contain the word “LoremIpsum” in random text layers, within each document. Is there a way I can search for “LoremIpsum” in all documents and replace it with “Dolor Sit Amet”, all in one go? This is just an example, I need to replace various words, not just one.
I have tried "batch find and replace" software (including powerful tools like Power Grep) but they do not work with psd files… Is there a javascript of external plugin for this kind of task?
Thanks!You’re welcome, advice given here is free.
If you want to donate something nonetheless you could do so over at
http://ps-scripts.com/bb/
Many of the same people used to contribute there as here and I for one have benefitted considerably from their generous advice on Scripting issues.
A Script can read (or create) txt files, but I do not have a lot of experience with this.
This might work (amend the line »var theTexts = readPref ("….txt", false);« according to your txt-file’s path):
// replace text elements in type layers;
// 2013, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
for (var n = 0; n < app.documents.length; n++) {
app.activeDocument = app.documents[n];
app.activeDocument.suspendHistory("replace text", "main()")
// the opertation;
function main () {
var myDocument = app.activeDocument;
var theTexts = readPref ("….txt", false);
var theArray1 = theTexts.slice(0, Math.round(theTexts.length/2));
var theArray2 = theTexts.slice(Math.round(theTexts.length/2), theTexts.length);
alert (theArray1.join("\n")+"\n\n\n"+theArray2.join("\n"))
for (var b = 0; b < theArray1.length; b++) {
replaceText (theArray1[b], theArray2[b])
////// reoplace text //////
function replaceText (replaceThis, replaceWith) {
// =======================================================
var idreplace = stringIDToTypeID( "replace" );
var desc22 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref3 = new ActionReference();
var idPrpr = charIDToTypeID( "Prpr" );
var idreplace = stringIDToTypeID( "replace" );
ref3.putProperty( idPrpr, idreplace );
var idTxLr = charIDToTypeID( "TxLr" );
var idOrdn = charIDToTypeID( "Ordn" );
var idAl = charIDToTypeID( "Al " );
ref3.putEnumerated( idTxLr, idOrdn, idAl );
desc22.putReference( idnull, ref3 );
var idUsng = charIDToTypeID( "Usng" );
var desc23 = new ActionDescriptor();
var idfind = stringIDToTypeID( "find" );
desc23.putString( idfind, replaceThis );
var idreplace = stringIDToTypeID( "replace" );
desc23.putString( idreplace, replaceWith );
var idcheckAll = stringIDToTypeID( "checkAll" );
desc23.putBoolean( idcheckAll, true );
var idFwd = charIDToTypeID( "Fwd " );
desc23.putBoolean( idFwd, true );
var idcaseSensitive = stringIDToTypeID( "caseSensitive" );
desc23.putBoolean( idcaseSensitive, false );
var idwholeWord = stringIDToTypeID( "wholeWord" );
desc23.putBoolean( idwholeWord, false );
var idignoreAccents = stringIDToTypeID( "ignoreAccents" );
desc23.putBoolean( idignoreAccents, true );
var idfindReplace = stringIDToTypeID( "findReplace" );
desc22.putObject( idUsng, idfindReplace, desc23 );
executeAction( idreplace, desc22, DialogModes.NO );
////// read prefs file //////
function readPref (thePath, binary) {
if (File(thePath).exists == true) {
var file = File(thePath);
file.open("r");
if (binary == true) {file.encoding= 'BINARY'};
var theText = file.read();
file.close();
return String(theText).split(",")
In this case the comma is used to split the text into Strings in Arrays, if your search/replace texts include commas you could use something else, I guess.
Maybe you are looking for
-
PL/SQL Report Headings Type question
Hi, If I set a report to use a Heading Type of "PL/SQL", is there a way to get the region id of the report from within the PL/SQL function that I provide in the "Function returning colon delimited headings" section? #REGION_ID# (available in a report
-
Rmi over ssl in jdk1.5.0
hi, i am trying to connect a remote machine with rmi over ssl. but i got the following exceptions; java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: Caused by: javax.net.ssl.SSLKeyException: RSA premaster s
-
Problem with direct input program while uploading data into database
TABLES: BGR00, " Mappensatz BMM00, " MM01/MM02 BTCI-Kopfdaten BMMH1, " MM01/MM02 Hauptdaten BMMH2, " Länderdaten (Steuern)
-
New mac mini, now I get generic tiffs in bridge, no raw in PS cc
Hi, I just replaced my 2006 pro mac with a 2012 mini. I am getting generic tiff icons in bridge, these are created in lightroom. I received some tifs from a friend and the correct icons show. Also my icons show properly in the finder. #2 Photoshop ca
-
I have 12 NI6225 DAQ Boards (~960 chs). I want to set up LV8 to read Ch1 on all 12 boards ( SW trigger) then Ch2 on all 12 boards, then Ch3 etc. I need to store ALL this data then process it ( post process?) after acquiring all 900 chs. Any sugge