Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help Please!

Guest
Dec 19, 2008 Dec 19, 2008
I couldn't get an answer from the forums about the DoScript that didn't, so I wrote my own script to do the search and replaces. That worked just fine.

So I decided to move on to another script that deletes styles.

What's wrong with this?

var myDocument = app.activeDocument;

//Remove Extraneous Styles

myDocument.paragraphStyles.item("Balloon Text").remove(myDocument.paragraphStyles.item("Body Text"));

The documentation and Object Browser are almost useless for a beginner.

Can someone please help? I would really appreciate it.
TOPICS
Scripting
459
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2008 Dec 19, 2008
Making a topic called "Help Please" is not very useful for users of the forum. I would suggest creating a new topic with a more relevant title.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 19, 2008 Dec 19, 2008
More to the point, what is wrong with the script you present. I gather that it doesn't work. In what manner does it fail?

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2008 Dec 19, 2008
When I run the script, I get an "Object is invalid" error message.

If I hover the cursor over the line, it shows up as a function.

Sorry--I didn't mean to be vague. I've spent almost three days trying to get three-line scripts to run and I'm really frustrated. The documentation is not terribly helpful, as it doesn't give a nice list of objects like that in Visual Basic.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 19, 2008 Dec 19, 2008
Are the style names you're using spelled exactly correctly? Are they in grouped folders?

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2008 Dec 19, 2008
Oh heck. It didn't run because I forgot to revert the file so the entire style list showed up.

So sorry.

But while I have you, can you tell me what is the Javascript equivalent of the Visual Basic On Error Resume Next?

I want to skip over styles that may not be in the current style list.

I do appreciate your time and trouble!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 19, 2008 Dec 19, 2008
LATEST
There's try{}catch(e){} which I think is close to what you describe.

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines