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

Export indd file to Snippets [VBS]

New Here ,
Aug 28, 2009 Aug 28, 2009

Hello all i'm trying to modify an existing script that Exports indd files to pdf's. it goes through all the indd file and createsa pdf one page at a time and workds fine. However in converting it to do the same but convert to Snippet files  i'm having problems with the "idExportFormat.idInDesignSnippet" class and memebers  when i try somthing like

myFilePath = myFolderName & "\" & myPageName & "_" & myBaseName & ".inds"
myDocument.Export idExportFormat.idInDesignSnippet, myFilePath, False

I get an "The Specified object to does support the desired export format." error # 25398

if i remove the  ",myflePath, False" then i get a "Missing required parameter 'To' for export event".

The really anying this is if i change that to a

myFilePath = myFolderName & "\" & myPageName & "_" & myBaseName & ".xml"
myDocument.Export idExportFormat.idXML, myFilePath, False

it works fine..

So there is somthing missing for the snippet export.

TOPICS
Scripting
2.5K
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 ,
Aug 28, 2009 Aug 28, 2009

There is nothing missing, I think. Can you export an entire document to a snippet in the user interface?

Try your script with a selection of objects instead.

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
New Here ,
Sep 01, 2009 Sep 01, 2009

No still having the same problem no what select or don't select.

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
New Here ,
Sep 03, 2009 Sep 03, 2009

I've been looking at the problem in more detial.

Some of the Export formats requrie presents to be set such as the EPS "EPSExportPreferences" JPG "JPEGExportPreferences" etc etc, which are in the Application class however there is no Export Preferences memebers for an InDesignSnippet....

Does anybody have any details about this?

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
New Here ,
Sep 04, 2009 Sep 04, 2009

I've broken the problem down and started as small as possible.

To do the same thing but to export each page as a jpg's i can use the following script

*******************************************************************************

Set myInDesign = CreateObject("InDesign.Application.CS3")
myFile = "c:\myTestFile.jpg"
myInDesign.ActiveDocument.Export idExportFormat.idJpg, myFile, False

*******************************************************************************

If i change that round a abit to customize it to export as inds snippets i would get

*******************************************************************************

Set myInDesign = CreateObject("InDesign.Application.CS3")
myFile = "c:\myTestFile.inds"
myInDesign.ActiveDocument.Export idExportFormat.idInDesignSnippet, myFile, False

*******************************************************************************

This produces the following error " The specified object does not support the desired export format"  - Line 3

This is because the object i am speifiying is "ActiveDocument" which when selected (manually) cannot be exported as a Snippet.

What I need to do is cycle trough my pages selecting Texframes of which they are multiple on each page and export them as Snippets.

Can anyone help please?

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
New Here ,
Sep 07, 2009 Sep 07, 2009

Hello all,

I've been doing some digging over the past few days and looking at Samples and other peoples questions/answers/scripts and i haven't seen any scripts where textframes have been selected which what i beleive i need to do. My question is. Is it even possible to select textframes if it is could someone tell me how if it isn't or i'm barking up the wrong tree could somone point me in the right direction please.

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
New Here ,
Sep 11, 2009 Sep 11, 2009

Nobody has anything to say about this?

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
LEGEND ,
Sep 11, 2009 Sep 11, 2009

hi

here is example for iterating trough all TFs on all Pages:

For a=1 to myDoc.Pages.Count

  Set myPage=myDoc.Pages.Item(a)

  For b=1 to myPage.TextFrames.Count

    Set myTextFrame=myPage.TextFrames.Item(b)

    Call myInDi.Select(myTextFrame)

  Next

Next

robin

www.adobescripts.co.uk

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
New Here ,
Sep 14, 2009 Sep 14, 2009

Thank you for your help.

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
New Here ,
Sep 21, 2009 Sep 21, 2009
LATEST

I've cracked it! thanks to Jongware for his input and a Maximum thanks to Robert-Tkaczyk for his input. here's the Script for all you googlers who need it!

Set myInDesign = CreateObject("InDesign.Application.CS3")
Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")
If myInDesign.Documents.Count <> 0 Then
Set myDocument = myInDesign.ActiveDocument
Rem VBScript doesn’t have a native "get folder" statement, so we’ll use
Rem InDesign’s JavaScript to display a folder browser.
myJavaScript = "myFolder = Folder.selectDialog(""Choose a Folder"");myFolderName = myFolder.fsName;"
Rem Run the string "myJavaScript" as a JavaScript
myFolderName = myInDesign.DoScript(myJavaScript,idScriptLanguage.idJavascript)
If myFileSystemObject.FolderExists(myFolderName) Then
myExportPages myInDesign, myDocument, myFolderName
End If
End If

Function myExportPages(myInDesign, myDocument, myFolderName)
myDocumentName = myDocument.Name
Set myDialog = myInDesign.Dialogs.Add

With myDialog
  .Name = "ExportAllPagesToPDF"
  With .DialogColumns.Add
  With .DialogRows.Add
    With .StaticTexts.Add
    .StaticLabel = "Base Name:"

  End With

  Set myBaseNameField = .TextEditboxes.Add
  myBaseNameField.EditContents = replace(myDocumentName,".indd","")
  myBaseNameField.MinWidth = 160
  End With
    End With
End With

myResult = myDialog.Show

If myResult = True Then
myBaseName = myBaseNameField.EditContents
Rem Remove the dialog box from memory.
myDialog.Destroy

For myCounter = 1 To myDocument.Pages.Count
myPageName = myDocument.Pages.Item(myCounter).Name
myInDesign.PDFExportPreferences.PageRange = myPageName
myInDesign.PDFExportPreferences.CropMarks = True

Rem Generate a file path from the folder name,
Rem the base document name, and the page name.
Rem Replace the colons in the page name (e.g., "Sec1:1") with
Rem underscores.

  Set myPage=myDocument.Pages.Item(myCounter)


  For b=1 to myPage.TextFrames.Count

    Set myTextFrame=myPage.TextFrames.Item(b)


    Call myInDesign.Select(myTextFrame)

Set myTF = myDocument.TextFrames.Item(1)

  myPageName = Replace(myPageName, ":", "_")
  myFilePath = myFolderName & "\" & myPageName & b & "_" & myBaseName & ".inds"
  myTextFrame.Export idExportFormat.idInDesignSnippet, myfilepath , false


Next

'Next

Next

Else

myDialog.Destroy
End If

End Function

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