Copy link to clipboard
Copied
We've got a script developed by an old IT person that works fine in CS3 but of course, fails miserably in CC.
'Set myInDesign = CreateObject("InDesign.Application.CS3")
Set myInDesign = CreateObject("InDesign.Application")
Set activeDoc = myInDesign.activeDocument
For Each tFrame in activeDoc.TextFrames
cText = tFrame.Texts.FirstItem.Contents
pos = InStr(cText,"name@domain.com")
if pos > 1 then
fillFrame(tFrame.Texts.FirstItem)
end if
Next
Function fillFrame(curFrame)
orderNbr = replace(activeDoc.name,".indd","")
' orderNbr = substring(0,activeDoc.name.Length-4)
fixedOrderNbr = orderNbr
do while len(fixedOrderNbr) < 8
fixedOrderNbr = "0" + fixedOrderNbr
loop
SQLstr = "select unnamed_11 from ""PartsDB"" where unnamed_0 = '" + fixedOrderNbr + "'"
set ad = CreateObject("ADODB.Connection")
ad.ConnectionString = "DRIVER={Pervasive ODBC Client Interface};ServerName=AMOS_SERVER;ServerDSN=AR"
ad.Open
Set rs = ad.execute(SQLstr)
custNbr = trim(rs.fields.item(0))
SQLstr = "select bill_to, add1, current_route_id from ""QCust"" where cust_id = '" + custNbr + "'"
set rs = ad.execute(SQLstr)
cName = trim(rs.fields.item(0))
cName = makeSentenceCaps(cName)
cAddr = trim(rs.fields.item(1))
cAddr = makeSentenceCaps(cAddr)
cRoute = trim(rs.fields.item(2))
That's most of it. The error pops up at line 24.
Windows Scripting Error!
#16389
Error String: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
Engine: Default
File: c:\Program files\...\Fill Out Proof Box.vbs
Line: 24
Given it works in CS3 I know the Data Source is correct. Apparently, CC has changed the way it deals with ODBC connections? I dunno...
Any thoughts on a solution?
Thanks,
Mike
Copy link to clipboard
Copied
This does not sound like an InDesign problem. Even though the name starts with "ADO", the ODBC access is part of Microsoft's ActiveX Data Objects subsystem. Connection Object (ADO)
As you are so sure about your CS3, is this the very same machine and OS installation where CS3 works?
Have you verified with any other ODBC program that the connection works on this machine?
You get an error from the "Microsoft ODBC driver manager", therefor I assume ODBC itself is installed correctly.
That "Pervasive" driver could still be missing - maybe you just need a 64bit version?
Even then, the driver may have a problem to resolve the AMOS_SERVER (different WORKGROUP, directory server and so forth) or miss some credentials implicitly stored on the other machine.
Much guesswork as I use a Mac most of the time. I'd suggest to post the problem also to some forum with focus on Microsoft VisualBasic.
Dirk
Copy link to clipboard
Copied
Yeah, I agree is sounds like a MS problem but I figured I'd start with InDesign since that's the program calling it.
Yes, same machine and OS. We have 7 computers with the same Win7 setup running CS3 that work. I don't know how to verify if other programs work with it except to say that our billing program uses PervasiveSQL to connect and that program works fine.
But, you've hit on a potential point in that the PervasiveSQL version we use is 8.5 which is 5 or 6 years old and did not support a 64b OS even though it would install. We had somehow figured out that the billing program has no problem accessing the database but we are unable to use any of the PervasiveSQL tools themselves to access the database.
So, that may still be the issue except that I'm unclear as to why this exact same script works in CS3 and not CC.
Thanks for your thoughts...
Mike
Copy link to clipboard
Copied
With a little help from Google, among others I found this discussion:
64bit - How do I run a VBScript in 32-bit mode on a 64-bit machine? - Stack Overflow
It might give a starting point - you basically have to use the 32bit scripting host "cscript".
Copy link to clipboard
Copied
Great, I'll check that out. I Googled the error number but got little of use. Still odd that it's works in CS3, though...
Copy link to clipboard
Copied
So, I found something on that page that supposedly forces cscript into 32b mode. I add it to the top of the script like it says and not InDesign has a "i" in front of every VB script and when I hover over it I get the message "this file is not executable by any supported script language". Lovely...
Copy link to clipboard
Copied
Let me repeat that I very rarely work with VBScript (last time was a short test program for some scriptable plugin back in CS2), therefor my suggestions are intentionally vague.
Try to invoke a separate 32bit VBScript for those database commands, from within your 64bit VBScript that deals with the InDesign side.
Within all those cryptic statements of the two long bottom posts in the Stack Overflow page, the essence is to invoke syswow64\cscript.exe
Instead of just re-starting the 64bit script, you'd isolate the 32bit parts that deal with ODBC in separate scripts.
You may also have to investigate how to pass your actual arguments and results across those calls.
Copy link to clipboard
Copied
Well, I'm no programmer and I have very little understanding of most of the Stack Overflow page and certainly have no idea how or where to invoke cscript. My apologies if I didn't say mention my lack of being a programmer earlier. We will have to find someone local that can come in and take a look at this pig and try to get it working. The loss of these two particular scripts will cost us a lot of time...
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more