Copy link to clipboard
Copied
Hi,
If I select a TextFrame and run exportFile to Snippet, everything is fine. If I select the insertionPoint and climb up towards the textframe then run the exportFile command on parent text frame, it fails. Same object as command source but two results 😕
someSelectedTextFrame.exportFile ( ExportFormat.INDESIGN_SNIPPET, f ); //SUCCESS
someSelectedInsertionPoint.parentStory.textContainers[0].exportFile ( ExportFormat.INDESIGN_SNIPPET, f ); //FAIL
I can't see why it would behave differently. It's lack the source object remains the insertionPoint somehow even if I run command from parent text frame 😕
Any ideas welcome.
Loic
Hi Loic,
the workaround is clear, I think.
Select the item or items you want to export.
However, that's no solution for InDesign Server.
Regards,
Uwe
Copy link to clipboard
Copied
textContainers[0] is an array element, maybe that's the problem. app.selection[0] too is an array element, but maybe a different kind. I wouldn't be surprised if the problem has something to do with that -- not very helpful!
Copy link to clipboard
Copied
Hi,
Did you try the textFrames from the story?
P
Copy link to clipboard
Copied
Hi Loic,
what version of InDesign are you working with?
If in CC 2018 you can try new methods for snippet export:
Re: Selection export without groupping
Regards,
Uwe
Copy link to clipboard
Copied
Hi Loic,
tested:
app.documents[0].exportPageItemsToSnippet( snippetFile , [id] );
where I get id from app.selection[0].parentStory.textContainers[0].id .
This is working with InDesign CC 2018.1 on Windows 10.
FWIW: I see the same issue as you do with exportFile().
Regards,
Uwe
Copy link to clipboard
Copied
Hi
Indeed,
myInsertionPoint.parentStory.textContainers[0] does return the textFrame instance. You can access any properties such as id.
However
myInsertionPoint.parentStory.textContainers[0].exportFile fails.
tried on Mac CC18 & CC17.
Even weirder accessing doc.pageItems.itemByID… also fails while isValid returns true.
And if app.selection[0] IS the textframe then app.selection[0].exportFile does work
Copy link to clipboard
Copied
Loic.Aigon wrote
…Even weirder accessing doc.pageItems.itemByID… also fails while isValid returns true.
And if app.selection[0] IS the textframe then app.selection[0].exportFile does work
Exactly. Also tried itemByID with the same result.
Regards,
Uwe
Copy link to clipboard
Copied
I think I will supply a bug report. Regarding to specific export to snippets function and while I understand the possible benefits, I am not that thrilled by the idea of special versioned functions. I like the genericity of exportFile and it would have been easy I guess to extend existing exportFile functions with some additional arguments.
But if it's all about dealing with InDesign versions with nineties hacks like (if version, else version), I don't see that as an advantage.
But I am not looking at trolling, just expressing a 2cts thought
And thanks a lot for sharing the info and your trials on this topic.
Loic
Copy link to clipboard
Copied
Hi Loic,
the workaround is clear, I think.
Select the item or items you want to export.
However, that's no solution for InDesign Server.
Regards,
Uwe
Copy link to clipboard
Copied
Hi Loïc,
Same test, same bug (Win10, ID 13.1 x64 ; identical issue in CS6 8.1)
An obvious conclusion is that ID does not want to have an insertion point currently selected within the very frame you are exporting.
So, once you have identified the frame by whatever means, just send app.select(null) before tf.exportFile(…). Seems to do the trick.
Weird!
@+
Marc
Copy link to clipboard
Copied
If one needs one might be able to do.
s = app.selection
tf.exportFile(…)
app.select(s)
to restore the selection.
Copy link to clipboard
Copied
Hi everyone,
Thanks for your inputs. It seems like the general consensus is that's a bug and that the workaround is to call app.select.
I will credit Uwe as he was the first to offer this hack.
However I will submit a bug report because it should work and the suggested hack may not only be resource consuming but also non applicable with IDS.
Thanks again to all,
Loic
Copy link to clipboard
Copied
So here is the bug report for whom may ever want to add his voice :
Copy link to clipboard
Copied
Voted.
Copy link to clipboard
Copied
Idem dito.
Copy link to clipboard
Copied
Sure that coukd work but the idea was to export textconainers of evey single story to idms so manual sélection isn’t really an option.