Solved

Crystal Report in WinXP, continued

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

785 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