If you give us a code snippet of what yiou currently have, we could help with the conditional statement...
Basically what I have is something like this:
frameType = "abc"
If Not (page.TextFrames.Item(frameType) is Nothing) Then
page.TextFrames.Item(frameType).ParentStory.Export idExportFormat.idTaggedText, "C:\" & frameType & "_output.txt"
Else msgBox "frame " & frameType & " doesn't exist."
So I'm looking for a TextFrame with the label "abc" and then outputting it to a text file.
The problem is getting the If statement to work properly. If i omit the if statement altogether, the code works fine to do what i want as long as a TextFrame with label "abc" exists. However, if no such TextFrame exists, it'll fail.
I've tried several variations on the If statement and nothing has worked so far.
If you are using CS4 or CS5, you can use (in js syntax):
// do your stuff
If you are using CS3 or lower, you'll need to wrap it in a try/catch.
Let's assume you have a single text frame selected:
Set myInDesign = CreateObject("InDesign.Application.CS3") Set mySelection = myInDesign.Selection(1) If mySelection.Label = "" Then MsgBox("The selected object has no label") Else MsgBox("The selected object has label: " & mySelection.Label) End If