Solved

Crystal Report in WinXP, continued

Posted on 2004-08-07
2
481 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
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…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

792 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