use warnings; use strict; use Data::Dumper; #changed the paths to office 12.0 (office 2007) values and the searche +d Key to "SharedTemplates" use Win32::TieRegistry( Delimiter => '#', ArrayValues => 0); my $pound = $Registry->Delimiter("/"); my $targetKey = $Registry->{"HKEY_CURRENT_USER/Software/Microsoft/Offi +ce/12.0/Common"} or die "Can't read the 'Common' key: $^E\n"; print STDERR "targetKey = '$targetKey'\n"; # this is the one you + called "data" before. It's not data, it's another key my $generalKey = $targetKey->{"General"} # this is another subkey or die "Can't read the 'General' subkey: $^E\n"; print STDERR "generalKey = '$generalKey'\n"; # this is the one y +ou called "data" before. It's not data, it's another key print STDERR Dumper $generalKey; # here, you can access actual values +from the key, with or without a prefixed slash my $data = $generalKey->{'/SharedTemplates'} // '<undef>'; printf STDERR qq("%s" => >>%s<<\n), '/SharedTemplates', $data; my $noslash = $generalKey->{'SharedTemplates'} // '<undef>'; printf STDERR qq("%s" => >>%s<<\n), 'SharedTemplates', $noslash; my $dne = $generalKey->{'DoesNotExist'} // '<undef>'; printf STDERR qq("%s" => >>%s<<\n), 'DoesNotExist', $dne; $targetKey = $Registry->{"HKEY_CURRENT_USER/Software/Microsoft/Office/ +12.0/Common"} or die "Can't read the '12.0/Common' key: $^E\n"; print STDERR "targetKey = '$targetKey'\n"; # this exists in mine $generalKey = $targetKey->{"General"} or die "Can't read the '12.0/Common/General' subkey: $^E\n"; print STDERR "generalKey = '$generalKey'\n"; # this doesn't exis +t in mine, so it won't get here

and a little shortened output:

C:\temp\strawberry-perl-5.26.0.2-64bit-portable>perl ..\example_code_o +ffice12_3.pl targetKey = 'Win32::TieRegistry=HASH(0x471ae8)' generalKey = 'Win32::TieRegistry=HASH(0x4719c8)' $VAR1 = bless( { '/Xlstart' => 'XLSTART', #just a simple example witho +ut "\" #... shortened #This is what is searched for: '/SharedTemplates' => 'G:\\OFFICE2007\\WORD7\\VORLAGE +N', # ... shortened '/PasteOptions' => '0x00000001' }, 'Win32::TieRegistry' ); "/SharedTemplates" => >>G:\OFFICE2007\WORD7\VORLAGEN<< "SharedTemplates" => >>G:\OFFICE2007\WORD7\VORLAGEN<< "DoesNotExist" => >><undef><< targetKey = 'Win32::TieRegistry=HASH(0x2561ec8)' generalKey = 'Win32::TieRegistry=HASH(0x471ae8)'



So thats very fine so far. Many thanks we are getting closer :-)
Thanks for your patience
mh88

In reply to Re^4: [OT] Using Module TieRegistry? for reading and pasting registrykey into another section by mh88
in thread [OT] Using Module TieRegistry? for reading and pasting registrykey into another section by mh88

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.