Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal Report in WinXP, continued

Posted on 2004-08-07
2
Medium Priority
?
505 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 2000 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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Six Sigma Control Plans
Screencast - Getting to Know the Pipeline

971 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