Solved

Crystal Report in WinXP, continued

Posted on 2004-08-07
2
485 Views
Last Modified: 2008-02-01
I got my answer from mysdaao.

Now I want to read the Registry information.

I am using the following code:

  Set objWShell = CreateObject("WScript.Shell")
  strTest = objWShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Printers\...\Port")
  strTest = objWShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\...\DsSpooler\driverName")
  strTest = objWShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\...\DsSpooler\portName")
  Set objWShell = Nothing

Now my problem is this:
First two commands are working correctly, but the third one which i need for portname generates an error of 'Type mismatch'.
Can anybody help me?
0
Comment
Question by:Parsi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
KJHDI12 earned 500 total points
ID: 11742674
portName is a REG_MULTI_SZ datatype. Meaning it can have one or more lines.

Documentation about this can be found here:
http://www.autohotkey.com/docs/commands/RegRead.htm

"When reading a REG_MULTI_SZ key, each of the components ends in a newline character (`n). If there are no components, OutputVar will be made blank. See FileSelectFile for an example of how to extract the individual components from OutputVar. Note: Windows 95 does not support the REG_MULTI_SZ value type."

variantTest =  objWShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\...\DsSpooler\portName")

Should fix it and return a array with all the ports (normaly only one).
0
 
LVL 2

Author Comment

by:Parsi
ID: 11745645
It worked,
Thanks a lot.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question