Script to search for text and remove the hyperlink and characterstyle link which applies (back to normal)
I need help with my script to search for text and remove the hyperlink and characterstyle link which applies (returns the normal text).
I can't do either as I want. I want the user to be able to type in a dialog text they want to search for, do search this text IGNORING case (case insensitive) and then for all instances that he find it, remove character styles that are applied to the (set to [none]) and delete the hyperlinks.
My code seems to define the character style [None], when I click on the text and look at the window of character Styles, BUT all old styles (font color, underline) are always applied and removed not as I want.
Also, I can't understand how to remove all of the old links.
Here is my code:
myDocument var = app.activeDocument;
var noneStyle = myDocument.characterStyles.item ("[None]");
var myFindVal = "";
var myErrorText = "";
var myErrorCount = 0;
myDialog = app.dialogs.add var ({name: "search user submitted text and delete hyperlinks from objects found.", canCancel: true});
{with (MyDialog)}
{with (dialogColumns.Add ())}
{with (borderPanels.Add ())}
staticTexts.add ({staticLabel: "search and delete hyperlinks for :"}); "})
myTextBox var = textEditboxes.add({minWidth:100});)
}
}
}
If (myDialog.show () == true) {}
myFindVal = myTextBox.editContents;
doSearchAndReplace();
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
If (myErrorCount == 0) {}
Alert ("done! ("Part of the links have been removed for: '" + myFindVal + ""! "");
}
else {}
Alert ("last error: '" + myErrorText + "' & number of errors:" + myErrorCount);
}
}
myDialog.destroy ();
function doSearchAndReplace() {}
app.findTextPreferences.findWhat = myFindVal;
app.findChangeTextOptions.caseSensitive = false;
app.findChangeTextOptions.includeFootnotes = false;
app.findChangeTextOptions.includeHiddenLayers = false;
app.findChangeTextOptions.includeLockedLayersForFind = false;
app.findChangeTextOptions.includeLockedStoriesForFind = false;
app.findChangeTextOptions.includeMasterPages = false;
app.findChangeTextOptions.wholeWord = false;
var myFoundItems = myDocument.findText ();
for (i = 0; i < myFoundItems.length; i ++) {}
myRemoveHyperlinkAndStyle (myFoundItems [i]);
}
}
function myRemoveHyperlinkAndStyle (myFoundItem) {}
try {}
myDocument.hyperlinkTextDestinations.item (myFoundItem) .remove ();
myDocument.hyperlinkTextSources.item (myFoundItem) .remove ();
myDocument.hyperlinkURLDestinations.item (myFoundItem) .remove ();
myFoundItem.applyCharacterStyle (noneStyle);
}
{catch (MyError)}
myErrorCount ++;
myErrorText = MonErreur;
}
}
Hello
Right, some hyperlink might be a pageItem...
expand the 'if' condition with:
If (myHyp [len].source.hasOwnProperty ("sourceText") &... content ==...)
Jarek
Tags: InDesign
Similar Questions
-
Search for text in all the labels in a Panel (like Ctrl-F)
Hello
I have a panel where I set some preferences for the application. He ara on 200 preferences. (a preference is a JLabel more a textfield/combobox/box)
I would like to know if someone has implemented something like Ctrl-F in browsers. The research should go through all the labels and highlight the labels that contain the text.
Thank you.You can use the getComponents() method to get all the components added to the Board. Browse the table and check if the current one is a JLabel instance. Then check the text in the JLabel and compare it with the search string. If necessary label highlighted (for example by changing the color of the text or add or remove line border color). Then, you can use the limits of the JLabel to make it visible in a parchment (if any).
-
Help with a script to search for text in a table cell and apply the cell style
Hello
I build the script which Jongware wrote in his post here http://indesignsecrets.com/tackling-tables-through-scripting.php - I am trying to create a variable in which I can add a number of different parts of the text, in this case it's different parts of the United Kingdom i.e. 'London', 'East', 'Scotland' etc. I just need the script to apply the cell Style - 'District Cell' - to any cell that contains text in the variable. Here's the script, if anyone can help I would be grateful.
function checkWhichTable() { // ensure the user made a selection if (app.selection.length != 1) return null; var currentTable = app.selection[0]; if (currentTable.hasOwnProperty("baseline")) { currentTable = app.selection[0].parent; } while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column) currentTable = currentTable.parent; if (!(currentTable instanceof Table)) { // No table selected return null; } return currentTable; } app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table"); function checkUserSelection () { var a_table = checkWhichTable(); if (a_table == null) { if (confirm("No table selected. Do you want to process *all* tables?") == false) return; allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements(); for (aTable=0; aTable<allTables.length; aTable++) { processTable (allTables[aTable]); } } else { processTable (a_table); } } function processTable(table) { // do something here! //Find Text in Cell and apply Cell Style var textInCell=['London', 'Scotland', 'South West']; for (i=0; i<table.cells.length; i++) { if (table.cells[i].texts[0].contents==textInCell) table.cells[i].appliedCellStyle = "District Cell"; } }
Hello
Change this feature:
function processTable(table) { //Find Text (exactly as it is) in Cell and apply Cell Style var textInCell=['London', 'Scotland', 'South West'], mFound, cFound; app.findGrepPreferences = null; app.findGrepPreferences.findWhat = "^(" + cities.join("|") + ")$"; mFound = table.findGrep(); while( cFound = mFound.pop() ) cFound.parent.appliedCellStyle = "District Cell"; }
Jarek
-
I tried to launch my Spysweeper and found that is not there, then I re downloaded and I could not install it because it was already on my computer. I went to the control panel to remove and got the message:
Windows cannot find C:\WINDOWS\system32\rundll32.exe. Make sure you typed the name correctly and then try again. To search for a file, select the Start button and then check the search...
What should I do?
Hi gsrow,
You can go there!
Cannot find the Rundll32.exe file when you open the control panel:
http://support.Microsoft.com/kb/812340Alternatively, copy the folder C:\Windows\System32\DllCache Rundll32.exe file to the System32 folder. Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]
-
Search for text in the option in Windows Search 4.0 Preview pane doesn't work do not
I use XP SP3. I recently downloaded Windows Search 4.0.
When the Windows search results window opens, I noticed that it is possible to search for text in the preview pane. I click on a file and go to OPTIONS > COMPONENT of VISUALIZATION, but see that FIND is grayed out and unavailable.
This function worked before, when I loaded Windows Search first; now, it no longer works. My files have been fully indexed; and I made no changes to the computer since then. I tried to restart the computer, but there was no change.
Any ideas? Matthew W. I. Dunn
Hello Matthew w. I. Dunn, welcome.
I recommend trying a system restore to see if that solves the problem. Try this:1. click on START2. click on "all programs".3. click on "Accessories".4. click on "system tools."5. click on "system restore."6 follow the prompts shown to restore your system to a date before the problem started. Although the system restore does not target the personal data, it is recommended that you back up all data such as music, photos and documents in case something is not bad.Let us know what happensThank you!Ryan Thieman
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think. -
I'm trying to find some similar text strings on hundreds of files. Specifically, I'm looking for dimensions. 4.50 "for example. I want to see how many files have this dimension within them so that I can group them for production purposes.
Is there a way to search for text in Illustrator (I use CS5) files from Finder? Or another program of research? I use a Mac.
Any help would be GREATLY appreciated and would help save me a lot of time.
Yes. While the Finder cannot find the content of .ai files, it can do it with .pdf files. If you change the extension of a .ai in .pdf file, you can use Spotlight to search by content.
This fact, combined with a file rename utility as A Better Finder Rename, you can leave temporarily rename all of your .ai files so they end up in something like 'RENAMED.pdf '. Then, once you have performed your search, find all files ending in RENAMED.pdf, to delete the word "RENAMED" and change the end for .ai again.
Of course, this isn't something you want to get into the habit of doing.
-
I get this error message when I try to open a mapped drive. I open the other drives mapped without any problem. However, if I type the path in\\servername\shareof the RACE, I can access the folder. I can also access this folder if I press the arrow in the address bar and select it from the list. Only when I click on it from my computer, I get the error message.
This PC has a new image just 2 days and I connect to another PC, I can access the mapped drive.
I search for virus and ran without effect registry cleaners.
It is a Windows XP SP3, HP probook 6550 b, the laptop computer is on a domain.
I hope you have a solution for this.
Thank you in advance.
Hi salame,.
Your Windows XP question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in theForums of TechNet Windows XP.
Visit our Microsoft answers feedback Forum and let us know what you think.
-
OT: security.
Dear community,
Did anyone out there contacted by "windows" say you they receive notifications about a virus tries to hijack your computer and ask for help to remove the files? Initially, it was an area code 855, but now the number is unavailable. I get a lot of calls.
any help would be appreciated
Thank you
Hello
It's a scam.
Here are the tips that we regularly give the posters who receive these types of calls:
We have all the errors and warnings in our Event Viewer
Either these so-called "Microsoft" Tech companies want to sell you a worthless software, or remote access to your computer to try to steal your credit card and bank information and also achieve an identity theft on you.
You are the only person who knows if you gave them remote access.
If you gave them remote access and you do Internet banking, contact your bank, to explain, and change passwords.
If you use your online credit card, cancel and get a new one issued to you.
And the only way that willl you know that you are free to them is to backup your data and do a clean install of your operating system.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
And Microsoft does not contact you unless YOU have made prior arrangements with them to do.
There is an article in the link I'm you provide at the end of this one
Read this Information from Microsoft:
"Avoid scams to phone for tech support.
http://www.Microsoft.com/security/online-privacy/avoid-phone-scams.aspx
Don't be fooled of unsolicited calls. Don't provide personal information.
Here are some of the organizations that cyber criminals claim to come:
Helpdesk Windows
Windows repair center
Microsoft technical support
Microsoft technical support
Windows Support Group Technical Department
Microsoft Research and Development Team (team of Microsoft R & D)
See you soon.
-
My computer crashed and after the purchase of another, I used the Migration Wizard to copy all the files to the new computer. Everything was going well until I tried to launch LR6. It was two weeks ago and a search for many pages of the Adobe Web site. I think I've exhausted all the remedies listed without success codes error A12E5 to questions cloud creative, Manager of Application and error 1: Configuration problems. I'm ready to reformat my computer and try again with Time Machine. Help would be greatly appreciated before I waste more time on this task. Any further suggestions?
Migration of Mac with Time Machine WILL NOT WORK with the Adobe program activations due to hidden registration files
Sign out of your account... Uninstall... to run vacuuming...
-non-Cloud programs, to disable the service before uninstalling
-http://helpx.adobe.com/creative-cloud/help/install-apps.html (and uninstall)
-using the vacuuming after uninstalling and before reinstalling is often necessary
-https://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html
-Restart your computer... Sign in to your account... Reinstall
-
How to search for text in all of the PDF files on a mobile device?
How to search for text in all of the PDF files on a mobile device?
Not possible on mobile devices.
-
Search for text when I start typing, I want to turn it off but it doesn'
I discuss in shows from time to time and I find it annoying when every time I start typing the computer begins to search for text. I went to the options of firefox and it is not enabled but search for it. Can you suggest a way I can stop this from happening?
Thank you
Sherrie
See:
- searchhotkeys: http://nic-nac-project.de/~kaosmos/index-en.html#searchkeys
-
Search for files and folders in XP
Simple search for files and folders in XP do not work. I can't find a string in a file. It works perfectly in 2000 and NT. I have admin rights and I am an owner of these files. Why XP can't look inside files?
Cannot find the files containing the text...
http://www.dougknox.com/XP/scripts_desc/xp_fix_search.htm
Using the "a word or Phrase in the file" search criterion may not work
http://support.Microsoft.com/default.aspx?scid=KB; EN-US; Q309173Search for content search not all Types of files for the specified string
http://support.Microsoft.com/default.aspx?scid=KB; EN-US; Q309447Another response of the community of Windows XP newsgroups
-
Search for blackBerry Smartphones Addressbook - the function "search".
"Find" my address book function does not work. I have a 1000 contacts and anything (that) I'm trying to look upwards until it says * no. addresses *.
I checked the filter function and nothing is selected. Any thoughts?
Thank you
Richard256
Hello Richard,.
You can try to reset the device by removing the battery for 30 seconds, then replace it. After restarting the device, try to search for a person in the address book.
-
Search for text on a Web page in ModernUI IE10
Is there a way to search for text on a Web page in the version of the modern UI for IE10?
If you use modern IE, the shortcut must be identical to it in most web browsers:
CTRL + FSo, open IE, select a text field that opens the keyboard on the screen, then tap on and hold down the Ctrl key and press F release both. You should see a little extra box we pop that is your field of research to this page.Gives you what you're looking for? -
Python script to search for users who belong to a group of weblogic
Hello
We know
Python script to search for users who belong to a particular group in weblogic
That's what I showed you already. You just need to add the function connect() and disconnect() around it and evaluate the slider that went back.
If you don't want to learn how to write your own script and that you just want to use an existing one, try this one Weblogic Scripting Tool 101: WLST list users, groups, and users in groups
Maybe you are looking for
-
IdeaPad s300 increase ram of 4 GB to 8 GB or 16 GB
I have 4 GB of ram in my model, it is possible to increase the RAM of this model? How many benches available memory for me? where I had 2 that I need to adapt to a 8 GB or 12 GB in total that I have to take it by force to another 4 GB? Thanks, sorry
-
During an office automatic however, patch cumulative for Activex killbitts for windows XP (KB2736233) has failed. error code is 0 x 80070017... How to fix this? He tells me that the installation failed, and when I close it, it asks me to instal
-
black screen after windows 8.1 update
Hello. I updated my laptop to windows 8 to 8.1 and when it restarted it shows just a black screen. I restarted the computer and has executed a HP diagnostic test and got this reading: failure of intelligent control, Id: product rlh2tk-6jx75x-mfgjw1 i
-
I have lost/misplaced my Windows 7 Home Premium product key
HELLO ALL, I NEED A PRODUCT KEY TO ACTIVATE MY WINDOWS, I TRIED TO DOWNLOAD FROM THE NET... I SEEM TO HAVE LOST / MISPLACED IT, PLEASE HELP... WINDOWS 7 HOME PREMIUM
-
is it necessary to configure switchable graphics?
I have Del Inspiron N5520 HD4000 Intel have provided with the Intel Core i7 processor and a separate video card, the AMD Radeon HD M 7670 , the user can choose to match labourWhat is the graphics processor...? After every 3-4 minutes, a window appear