This is my code for now, it looks up the registry entries at HKCU\Software\Microsoft\DevStudio\6.0\Tools and searches for an entry thats called "NumTools" and write the value of it to $NumTools.
use Win32::Registry; my $NumTools; $p = "Software\\Microsoft\\DevStudio\\6.0\\Tools"; $main::HKEY_CURRENT_USER->Open($p, $Tools) || die "Open: $!"; $Tools->GetValues(\%vals); foreach $k (keys %vals) { $key = $vals{$k}; IF ($$key[0] eq "NumTools") { $NumTools = $$key[2]; } }
Now I have to make sure that there is none of the entries that have the value "C:\Tool\Lint\Bin\Lint.exe", but I can't figure out how to put it in an IF sentence. I was thinking of something like:
IF ($$key[2] eq "C:\\Tool\\Lint\\Bin\\Lint.exe") { print "PC-Lint is already installed"; } ELSE {
And then the code below.
Then it has to put in some registry entries if it's true, and they work.
$Tools->SetValueEx("AskArgument#$NumTools", 0, REG_DWORD, "0"); $Tools->SetValueEx("CloseWindow#$NumTools", 0, REG_DWORD, "0"); $Tools->SetValueEx("DefaultArguments#$NumTools", 0, REG_SZ, ""); $Tools->SetValueEx("GUITool#$NumTools", 0, REG_DWORD, "0"); $Tools->SetValueEx("InitialDirectory#$NumTools", 0, REG_SZ, "C:\\Tool\ +\Lint\\Bin"); $Tools->SetValueEx("MenuName#$NumTools", 0, REG_SZ, "PCLint"); $Tools->SetValueEx("OutputRedirect#$NumTools", 0, REG_DWORD, "0"); $Tools->SetValueEx("PathName#$NumTools", 0, REG_SZ, "C:\\Tool\\Lint\\B +in\\Lint.exe"); $Tools->SetValueEx("ReloadNoPrompt#$NumTools", 0, REG_DWORD, "0"); $Tools->SetValueEx("UseSearchPath#$NumTools", 0, REG_DWORD, "0"); $Tools->SetValueEx("VisibleOnMenu#$NumTools", 0, REG_DWORD, "0"); $NumTools++; $Tools->SetValueEx("NumTools", 0, REG_DWORD, "$NumTools"); }
But somehow it allways comes with the error
syntax error at extract.pl line 9, near ") {"
syntax error at extract.pl line 11, near "}"

that is these 2 lines:
IF ($$key[0] eq "NumTools") { $NumTools = $$key[2]; } }
Can anyone help me figure out what is wrong? Please?

In reply to registry problems by perlnewbie2000

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.