Thread View: adobe.scripting.indesign
10 messages
10 total messages
Started by robin521
Mon, 16 Feb 2009 04:23
it can not search the text with Grep, what's wronge with my code?
Author: robin521
Date: Mon, 16 Feb 2009 04:23
Date: Mon, 16 Feb 2009 04:23
22 lines
1621 bytes
1621 bytes
Hi scripter, I got a Arabian files that include English and arabian fonts, but i need to find Arabian to change Fonts style. my grep may got some pro. please see the below: //Clear the find/change preferences. app.findGrepPreferences = NothingEnum.nothing; app.changeGrepPreferences = NothingEnum.nothing; //Set the find options. app.findChangeGrepOptions.includeFootnotes = false; app.findChangeGrepOptions.includeHiddenLayers = false; app.findChangeGrepOptions.includeLockedLayersForFind = false; app.findChangeGrepOptions.includeLockedStoriesForFind = false; app.findChangeGrepOptions.includeMasterPages = false; //Regular expression for finding an email address. app.findGrepPreferences.findWhat = "[^A-Za-z0-9/.-]+"; //Apply the change to 24-point text only. app.findGrepPreferences.pointSize = 24; app.changeGrepPreferences.underline = true; app.documents.item(0).changeGrep(); //Clear the find/change preferences after the search. app.findGrepPreferences = NothingEnum.nothing; app.changeGrepPreferences = NothingEnum.nothing;
Re: it can not search the text with Grep, what's wronge with my code?
Author: rhariharasudhan05
Date: Mon, 16 Feb 2009 07:02
Date: Mon, 16 Feb 2009 07:02
16 lines
1102 bytes
1102 bytes
Dear robin521, I saw your code, and below I have to change the code Your code : //Regular expression for finding an email address. app.findGrepPreferences.findWhat = "[^A-Za-z0-9/.-]+"; Change Code: //Regular expression for finding an email address. app.findGrepPreferences.findWhat = [A-Za-z0-9._%-]+@(?:[A-Za-z0-9-]+\.)+([A-Za-z]*) Please use the above code and get correct answers, Let me know if you have any queries. Thanks & Regards T.R.Harihara SudhaN
Re: it can not search the text with Grep, what's wronge with my code?
Author: Peter Kahrel
Date: Mon, 16 Feb 2009 09:25
Date: Mon, 16 Feb 2009 09:25
17 lines
1071 bytes
1071 bytes
Do you want to find Arabic or email addresses? Whichever, in your other topic on the same subject I replied that your GREP is faulty:
app.findGrepPreferences.findWhat = "[^A-Za-z0-9/.-]+";
should be
app.findGrepPreferences.findWhat = "[^A-Za-z0-9\\.-]+";
But this isn't going to find Arabic or email addresses: it finds everything that's not an unaccented Latin letter, a digit, dot, or hyphen.
Peter
Re: it can not search the text with Grep, what's wronge with my code?
Author: robin521
Date: Wed, 18 Feb 2009 07:58
Date: Wed, 18 Feb 2009 07:58
28 lines
1778 bytes
1778 bytes
Hi Peter,
yes, you are right! I need to find Arabic and i have been change my Grep, But there are still has no responses with my Indesign.
if(app.documents.length ==0){
alert("您没有打开任何文档!");
}
//Clear the find/change preferences.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
//Set the find options.
app.findChangeGrepOptions.includeFootnotes = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeMasterPages = false;
//找到匹配的阿拉伯文文字进行修改.
app.findGrepPreferences.findWhat = "[^A-Za-z0-9\\.-]+";
app.changeGrepPreferences.underline = true;
app.documents.item(0).changeGrep();
//Clear the find/change preferences after the search.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
Re: it can not search the text with Grep, what's wronge with my code?
Author: jongware
Date: Wed, 18 Feb 2009 09:58
Date: Wed, 18 Feb 2009 09:58
8 lines
704 bytes
704 bytes
The
findWhat
specifies what is searched for. You'll have to change that.
Re: it can not search the text with Grep, what's wronge with my code?
Author: Peter Kahrel
Date: Wed, 18 Feb 2009 10:02
Date: Wed, 18 Feb 2009 10:02
3 lines
903 bytes
903 bytes
How is the Arabic coded? In your InDesign document, select a character which you expected to be found but isn't and press F8 to display the Info panel. Somewhere in the centre of the panel you see "Unicode: " followed by a unicode value. Tell us what you see there. Peter
Re: it can not search the text with Grep, what's wronge with my code?
Author: robin521
Date: Mon, 23 Feb 2009 06:41
Date: Mon, 23 Feb 2009 06:41
33 lines
1893 bytes
1893 bytes
Hi peter,
Sorry for late, i can not post my message.
I got it, Cause of low memory, I have already change it, but how can i change desiredWordSpacing=130 what i find? I need to change all character to desiredWordSpacing=130.
try{
if(app.documents.length ==0){
alert("您没有打开任何文档!");
}
}
catch(e){
}
//Clear the find/change preferences.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
//Set the find options.
app.findChangeGrepOptions.includeFootnotes = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeMasterPages = false;
//找到匹配的阿拉伯文文字进行修改.
app.findGrepPreferences.findWhat = "[^A-Za-z0-9\\.-]+";
app.changeGrepPreferences.appliedFont="Arial"
app.documents.item(0).changeGrep();
//Clear the find/change preferences after the search.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
Re: it can not search the text with Grep, what's wronge with my code?
Author: Peter Kahrel
Date: Mon, 23 Feb 2009 06:53
Date: Mon, 23 Feb 2009 06:53
3 lines
717 bytes
717 bytes
desiredWordSpace applies to paragraphs. What you're after is probably tracking. Peter
Re: it can not search the text with Grep, what's wronge with my code?
Author: robin521
Date: Mon, 23 Feb 2009 09:35
Date: Mon, 23 Feb 2009 09:35
9 lines
999 bytes
999 bytes
Hi Peter, when i found the text base on GREP, Need to increase 30 percent PointSize and change font, Now, I found that needn't to change desiredWordSpacing, PointSize is ok.(pointSize*1.3) I have two questions, how can i get the fontlist of current document and display on menu or dialogs, can i return a int in order to increase pointSize. Thanks very much. Regards, Robin
Re: it can not search the text with Grep, what's wronge with my code?
Author: Peter Kahrel
Date: Mon, 23 Feb 2009 19:31
Date: Mon, 23 Feb 2009 19:31
18 lines
972 bytes
972 bytes
I have two questions, how can i get the fontlist of current document and
display on menu or dialogs
Just get an array of font names, probably something like myDoc.fonts.everyItem().name and display it in a dropdown list in a dialog.
can i return a int in order to increase pointSize.
Sure.
Peter
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads