Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Windows Registry

by akm2 (Scribe)
on Mar 29, 2001 at 06:05 UTC ( [id://68028]=perlquestion: print w/replies, xml ) Need Help??

akm2 has asked for the wisdom of the Perl Monks concerning the following question:

Look at The example of the IndigoPerl installation script, I found they use something like the following code to add shortcuts to the startmenu.

sub MakeShortcut{ use Config; use Win32::API; use Win32::Shortcut; use Win32::Registry; use strict; use DSUtil; my ($shortcutfoldername, $configUser) = @_; my ($key); if ($configUser || Win32::IsWin95()) { $key = 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explore +r\Shell Folders\Programs'; } else { $key = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explore +r\Shell Folders\Common Programs'; } my $folderdir = DS::GetReg($key); my $folderpath = "$folderdir\\$shortcutfoldername"; print "Creating shortcut folder $folderpath\n"; mkdir ($folderpath, 0777); print "Making shortcut Tk Solitaire\n"; my $LINK=new Win32::Shortcut(); $LINK->{'Path'}="\\Tk Solitaire\\Tk Solitaire.exe"; $LINK->{'Arguments'}=""; $LINK->{'WorkingDirectory'}=\\Tk Solitaire; $LINK->{'Description'}="Tk Solitaire"; $LINK->{'ShowCmd'}=SW_SHOWNORMAL; $LINK->Save("$folderpath\\Tk Solitaire.lnk"); $LINK->Close(); }

DSUtil (witch is required for the my $folderdir = DS::GetReg($key); line of code) is not a module for ActiveState ActivePerl. Please help me rewite to above code to work with ActiveState ActivePerl.

Replies are listed 'Best First'.
(tye)Re: Windows Registry
by tye (Sage) on Mar 29, 2001 at 11:49 UTC

    Well DSUtil.pm is just Perl code so you can go read it yourself and see what it does. But this

    use Win32::TieRegisry ( Delimiter=>"/" ); my ($key); if ($configUser || Win32::IsWin95()) { $key = 'CUser/Software/Microsoft/Windows/CurrentVersion/Explor +er/Shell Folders//Programs'; } else { $key = 'LMachine/SOFTWARE/Microsoft/Windows/CurrentVersion/Exp +lorer/Shell Folders//Common Programs'; } my $folderdir = $Registry->{$key};
    works just fine as a replacement.

            - tye (but my friends call me "Tye")
Re: Windows Registry
by Albannach (Monsignor) on Mar 29, 2001 at 08:36 UTC
    You might try Win32::TieRegistry which should be in the standard ActiveState installation: It worked for a couple of simple tests but I should mention that the key you're looking for doesn't exist on my Win95 box.

    --
    I'd like to be able to assign to an luser

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://68028]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-03-29 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found