-
1. Re: Script to convert one style to another
Mac_rk Aug 20, 2013 9:33 PM (in response to Asher31)try below code
var myDoc = app.activeDocument;
var importedStyle = myDoc.paragraphStyles.item("H1");
var ApplyStyle = myDoc.paragraphStyles.item("ActiviyH1");
importedStyle.remove(ApplyStyle);
-
-
3. Re: Script to convert one style to another
Mac_rk Aug 20, 2013 10:08 PM (in response to Asher31)// which style you went to find and replace add like below metion 1st tow line
replaceStyle("H1", "ActiviyH1");
replaceStyle ("H2", "ActiviyH2")
function replaceStyle(find, replace){
try{
var myDoc = app.activeDocument;
var importedStyle = myDoc.paragraphStyles.item(find);
var ApplyStyle = myDoc.paragraphStyles.item(replace);
importedStyle.remove(ApplyStyle);
}
catch(e){
alert (e)
}
}
-
4. Re: Script to convert one style to another
Asher31 Aug 20, 2013 10:18 PM (in response to Mac_rk)I'm getting "referenceError: object invalid" which from some testing seems to be from the 'replaceStyle' but what it could be is that my styles are in folders, do i need to define the folder too? Also can the styles have spaces in them or will that break it.
Thank you so much for your help so far
-
5. Re: Script to convert one style to another
Mac_rk Aug 20, 2013 11:11 PM (in response to Asher31)// which style you went to find and replace add like below metion 1st tow line
replaceStyle("Old", "H1", "new", "ActiviyH1");
replaceStyle ("Old", "H2", "new","ActiviyH2")
function replaceStyle(GroupOld , find, GroupNew, replace){
try{
var myDoc = app.activeDocument;
importedStyle = myDoc.paragraphStyleGroups.item(GroupOld).paragraphStyles.item(find);
ApplyStyle = myDoc.paragraphStyleGroups.item(GroupNew).paragraphStyles.item(replace);
importedStyle.remove(ApplyStyle);
}
catch(e){
//alert (e)
}
}
-
-
7. Re: Script to convert one style to another
Mac_rk Aug 20, 2013 11:22 PM (in response to Asher31)sorry mis type
replace this line " ApplyStyle = myDoc.paragraphStyleGroups.item(GroupNew).paragraphStyles.item(replac e);"
with "ApplyStyle = myDoc.paragraphStyleGroups.item(GroupNew).paragraphStyles.item(replace);"
space is there replac e
-
8. Re: Script to convert one style to another
Asher31 Aug 21, 2013 12:34 AM (in response to Mac_rk)Still not having any luck, although got rid of the error so i'm thinking that the issue now is the bits i need to change/adjust depending on my local settings.
After playing with it i have a couple of questions that might help with the solution...
1) In line "replaceStyle("Old", "H1", "new", "ActiviyH1");"
Are 'Old' and 'New' meant to be the names of the folders the styles are in? Do we HAVE to include them? If it's possible to do it without saying the folders (even if the styles are in folders/groups) that would be heaps easier as the old style are so deeply nested it would take a while.2) For the style names, can the name have space in it, as my names at the moment have spaces in them.
Again thank you so much for taking the time to help me hope we can get this worked out.
-
9. Re: Script to convert one style to another
Mac_rk Aug 21, 2013 12:37 AM (in response to Asher31)can u send me ur paragarph style pallete snap shot
-
10. Re: Script to convert one style to another
Asher31 Aug 21, 2013 12:51 AM (in response to Mac_rk) -
11. Re: Script to convert one style to another
Asher31 Aug 22, 2013 12:53 AM (in response to Mac_rk)I played around a bit more and got it worked out, mainly thanks to you.. i think it is all sorted now except i have one question i thought you might be able to help with ...
How do i show the top level directory for a style, so one that isn't in a group, but still keeping the dinfing group bit so i can also have ones in directories in the group...
thanks in advance and thank you for all the past help, you rock




