Skip to main content
Participating Frequently
October 29, 2008
Question

Development Guidance

  • October 29, 2008
  • 15 replies
  • 1448 views
Hi.

I work with Microsoft NAV (formerly Navision) and a requirement has come up to somehow interface NAV with InDesign. The task is to produce (fairly simple) product tags based on data within NAV (item number, description, dimensions, price, etc.) The tags are currently being produce 'by hand'.

InDesign has an obviously rich and varied development environment - so much so that it's a bit overwhelming to the uninitiated. What I am looking for are some 'high-level' suggestions on how to 'marry' NAV with InDesign. By high-level, I mean just point me in the right direction and I'll do the had work of figuring it out. I'm just hoping to avoid wasting a lot of time going down blind alleys.

Thanks in advance for any pointers you may have.

Bob
This topic has been closed for replies.

15 replies

Participating Frequently
November 13, 2008
Thank-you Jim, and the rest of you as well.

I've pretty-well cracked this though.

First, I spent (wasted) a lot of time trying to run InDesign from NAV using Automation. It's 'supposed' to work, but I go up in smoke real fast trying to boot InDesign. MS is looking at it, but won;t guarantee any answer. (Strange, I can boot it through the COM interface package in Tcl/Tk.)

I settled on a new approach, and have a running demo working. I export data from NAV in a CSV file, then generate a VBS script that boots InDesign, opens a given indd file (which I have populated with merge codes), sets the merge datasource, and then performs the merge:

Set inDesign = CreateObject("InDesign.Application.CS3")
Set myDocument = inDesign.Open("c:\Demo\MergeExample1.indd")
Set dataMerge = myDocument.DataMergeProperties
dataMerge.SelectDataSource("c:\Demo\InDesignSampleNavData.txt")
dataMerge.MergeRecords

It works like a charm.

In case anyone is interested, here's the equivalent Tcl/Tk script:

package require tcom
set inDesign [::tcom::ref createobject InDesign.Application.CS3]
after 10000; # To allow all dialogs to settle down
set myDocument [$inDesign Open "c:\\Demo\\MergeExample1.indd"]
set dataMerge [$myDocument DataMergeProperties]
$dataMerge SelectDataSource c:\\Demo\\InDesignSampleNavData.txt
$dataMerge MergeRecords

So, I'm good for now - this will do what the customer wants.

Again, thank-you to all who contributed.

Bob
Inspiring
November 13, 2008
Hi Bob H.,

Can you do TCP socket communications in your environment? I ask because I have written an InDesign Plug-In that allows an application (or whatever) to communicate with InDesign via TCP/IP. The way it is currently used is to pass in script text or a filepath to a script (JavaScript, AppleScript, or VBScript), and then have the Plug-In run the script. I've used my Plug-In for a number of projects of my own, and it works quite well.

Also, I agree with Bob Stucky when he mentioned getting some scripting help. Unless you have some experience with InDesign, you would likely benefit from the help of someone with InDesign scripting experience. From your comments, I think that the coding part would be a quick learn for you; however, the InDesign Scripting API takes some time to learn.

If you want to discuss the Plug-In, please send me an email. You can find my email address by clicking on my name in this message.

-- Jim
November 10, 2008
Bob,

The basic process is to import an XML file and then to place that XML into one or more text frames.

The details of how best to approach the problem depend, in some part, on the data and how it will be formatted in InDesign (will any of the data be in tables, for example).

While you can put the time into learning how to do this on your own, I would recommend that you engage a consultant to help you through the first one. Once you see how to do it, it will make sense and seem relatively straight forward.

I am available to help, as are a number of other folks who frequent this forum.

Regards

Bob Stucky
bob.stucky@starband.net
frameexpert
Community Expert
Community Expert
November 10, 2008
Hi Bob,

I am an InDesign scripting newbie, so I will defer to others on the list. My expertise is in the FrameMaker/FrameScript arena.

Rick
rick at frameexpert dot com
www.frameexpert.com
Participating Frequently
November 10, 2008
Ole: I have seen other references here to the file "Resources for Visual Basic.tlb". I found it on my system, but you can't 'register' it using regsvr32 because it's nor a dll or ocx. So ... I really don't know what to do with it. (Plus, I'm not using Visual Basic.)

Rick: You are probably right, there's only so much time I can waste on the Automation route. I do have XML import/export capabilities in NAV, and know them well. So now the hurdles would be to identify the elements I need to export, and how to script ID to take a given 'template' file and apply the XML data to it. Can you suggest the simplest way to get a 'Hello World' up and running in this context?

Many (many!) thanks to you both.

Bob
frameexpert
Community Expert
Community Expert
November 8, 2008
Hi Bob,

If you run into a brick wall working with InDesign via NAV, you might try pushing data out of NAV to XML (or some other format), and then use InDesign scripting to import the XML data into InDesign. It's not as elegant but it may be more straightforward scripting-wise.

Rick Quatro
www.frameexpert.com
Participating Frequently
November 7, 2008
Here is sample source that boots Excel from NAV:

// xlApp is Automation variable, Excel Application
// xlLogSheet is Automation variable, Excel Sheet
// etc.

CREATE(xlApp);
xlBook := xlApp.Workbooks.Add(-4167);
//
xlLogSheet:= xlBook.Sheets.Add;
xlLogSheet.Name('Messages');
ExcelCellSet(xlLogSheet,1,'A','Line');
ExcelCellSet(xlLogSheet,1,'B','Message');
//
xlErrorSheet:= xlBook.Sheets.Add;
xlErrorSheet.Name('Errors');
ExcelCellSet(xlErrorSheet,1,'A','Line');
ExcelCellSet(xlErrorSheet,1,'B','Error');

etc.
----------------------
Function ExcelCellSet(Sheet : Automation "'Microsoft Excel 11.0 Object Library'.Worksheet";Row : Integer;Col : Text[30];Value : Text[128])
Sheet.Range(Col+FORMAT(Row)).Value := Value;
----------------------

So, I can use the VB documentation to determine the methods & properties to manipulate, but the environment is quite different. For example, the specifics of variable declarations (type, length, etc.) are all buried in the GUI (except in the function signatures, like above).

Bob
Known Participant
November 7, 2008
Hi Bob,

When you said, "This is the same as I would use for Excel - and it work's just fine with it."

I guess I was thinking that NAV uses VBA. But I guess you probably meant going from NAV to Excel...right? What does the line look like in NAV for Excel?

What you need to register is the "Resources for Visual Basic.tlb"--where, exactly, varies. The best thing to do is search for it.

<Rock>Bob<crowbar>Ole<Hard Place>:-)

Thanks,

Ole
Participating Frequently
November 7, 2008
Hi Olav.<br /><br />My problem here is that I'm not using Visual Basic. While NAV is an MS product, it's heritage is not. So, the development environment, syntax, etc. are quite different. <br /><br />I have opened a support incident with the MS NAV team, and their response so far has been to "make sure the OCX or dll is registered". The problem is, I have no idea which dll needs registering. ALso, since the InDesign type library classes appear in the NAV dev delopment GUI, I would think that it was already there. ...?<br /><br /><Rock> me <Hard Place><br /><br />Bob
Known Participant
November 7, 2008
Hi Bob,

Did you use something like this:

Set myInDesign = CreateObject("InDesign.Application.CS3"

If that doesn't work, try the type library registration shown in:

http://www.adobeforums.com/webx/.3c064bf7/13

Thanks,

Ole