executing Desktop shortcut
Is it possible to execute a desktop shortcut on Win2k using AS Perl? I used to do this on win98 by just adding .lnk to the path\file name and putting it in a system statement, but that doesn't work on 2k. And I tried guitest which seems should work, and didn't, but I'm not locked into that if there's any other thoughts. Thanks. ms Suppose you were an idiot. And suppose you were a member of Congress. But I repeat myself. -- Mark Twain ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: executing Desktop shortcut
On Fri, 04 Feb 2005, M. Smith wrote: Is it possible to execute a desktop shortcut on Win2k using AS Perl? I used to do this on win98 by just adding .lnk to the path\file name and putting it in a system statement, but that doesn't work on 2k. And I tried guitest which seems should work, and didn't, but I'm not locked into that if there's any other thoughts. Try something like system(cmd /c start shortcut.lnk); Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: executing Desktop shortcut
Worked ok for me opening a Word template on WinXP Pro: system('C:\Documents and Settings\peter\Desktop\LETTERHEAD.dot.lnk'); -Original Message- From: M. Smith [mailto:[EMAIL PROTECTED] Sent: Friday, February 04, 2005 4:28 PM To: perl-win32-users@listserv.ActiveState.com Subject: executing Desktop shortcut Is it possible to execute a desktop shortcut on Win2k using AS Perl? I used to do this on win98 by just adding .lnk to the path\file name and putting it in a system statement, but that doesn't work on 2k. And I tried guitest which seems should work, and didn't, but I'm not locked into that if there's any other thoughts. Thanks. ms Suppose you were an idiot. And suppose you were a member of Congress. But I repeat myself. -- Mark Twain ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs __ Message transport security by GatewayDefender.com 4:32:48 PM ET - 2/4/2005 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Desktop shortcut
Mark, Here is a way to make a shortcut to a file or URL using OLE. James use Win32::OLE; $WSH = Win32::OLE-new('Wscript.Shell'); $SC = $WSH-CreateShortcut($WSH-SpecialFolders('AllUsersDesktop').\\Sample.lnk); $SC-{WindowStyle} = 4; # 3=Maximized 4=Normal 7=Minimized $SC-{TargetPath} = %windir%\\notepad.exe; $SC-{Hotkey} = ALT+CTRL+N; $SC-Save; -Original Message- From: Ricci, Mark [mailto:mricci;wordwave.com] Sent: Friday, October 25, 2002 8:05 AM To: '[EMAIL PROTECTED]' Subject: Desktop shortcut Hello, Is there a perl module that will automate creating a desktop shortcut? Thanks, Mark ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Desktop shortcut
Thanks, James. Will your script work on both Win98 and 2k systems? I ended up using this script due to issues with 98: use Win32::Shortcut; use File::Copy; if ($OS) { $User = Win32::LoginName(); $Dir2k = c:\\documents and settings\\$User\\desktop; print $Dir2k\n; create2k; } else { $Dir98 = c:\\windows\\desktop; print $Dir98\n; create98; } sub create2k { print Creating the link in 2k\n; my $LINK=new Win32::Shortcut(); $LINK-Path($lldir\\$llexe); $LINK-Arguments(); $LINK-WorkingDirectory($lldir); $LINK-Description('Reports'); #$LINK-ShowCMD(SW_SHOWNORMAL); $LINK-Save($Dir2k\\Reports.lnk); } sub create98 { print Creating the link in 98\n; my $LINK=new Win32::Shortcut(); $LINK-Path($lldir\\$llexe); $LINK-Arguments(); $LINK-WorkingDirectory($lldir); $LINK-Description('Reports'); #$LINK-ShowCMD(SW_SHOWNORMAL); $LINK-Save($Dir98\\Reports.lnk); } # Mark -Original Message- From: Krummel, James C - PGGC-6 [mailto:jckrummel;bpa.gov] Sent: Friday, October 25, 2002 2:47 PM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: Desktop shortcut Mark, Here is a way to make a shortcut to a file or URL using OLE. James use Win32::OLE; $WSH = Win32::OLE-new('Wscript.Shell'); $SC = $WSH-CreateShortcut($WSH-SpecialFolders('AllUsersDesktop').\\Sample.lnk) ; $SC-{WindowStyle} = 4; # 3=Maximized 4=Normal 7=Minimized $SC-{TargetPath} = %windir%\\notepad.exe; $SC-{Hotkey} = ALT+CTRL+N; $SC-Save; -Original Message- From: Ricci, Mark [mailto:mricci;wordwave.com] Sent: Friday, October 25, 2002 8:05 AM To: '[EMAIL PROTECTED]' Subject: Desktop shortcut Hello, Is there a perl module that will automate creating a desktop shortcut? Thanks, Mark This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. Any review, use, disclosure or distribution by persons or entities other than the intended recipient(s) is prohibited. If you are not the intended recipient, please contact the sender by reply and destroy all copies of the original message. Thank you. WordWave, Capturing the Power of the Spoken Word http://www.wordwave.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Desktop shortcut
Mark, It should work properly on a Win9x machine, as I asked the OS for the location of the desktop rather then using a hardcoded path, although I do not know if it supports the All Users Desktop tag. Here is a list of most of the standard folders the OS tracks on. Win9x does not support them all, but Win2k does. James use Win32::OLE; $WSH = Win32::OLE-new('Wscript.Shell'); print $ENV{WINDIR}.\n; print $ENV{SYSTEMROOT}.\n; print $WSH-SpecialFolders('AllUsersDesktop').\n; print $WSH-SpecialFolders('AllUsersStartMenu').\n; print $WSH-SpecialFolders('AllUsersPrograms').\n; print $WSH-SpecialFolders('AllUsersStartup').\n; print $WSH-SpecialFolders('Desktop').\n; print $WSH-SpecialFolders('Favorites').\n; print $WSH-SpecialFolders('Fonts').\n; print $WSH-SpecialFolders('MyDocuments').\n; print $WSH-SpecialFolders('NetHood').\n; print $WSH-SpecialFolders('PrintHood').\n; print $WSH-SpecialFolders('Programs').\n; print $WSH-SpecialFolders('Recent').\n; print $WSH-SpecialFolders('SendTo').\n; print $WSH-SpecialFolders('StartMenu').\n; print $WSH-SpecialFolders('Startup').\n; print $WSH-SpecialFolders('Templates').\n; -Original Message- From: Ricci, Mark [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: Desktop shortcut Date: Fri, 25 Oct 2002 14:53:05 -0400 Thanks, James. Will your script work on both Win98 and 2k systems? I ended up using this script due to issues with 98: use Win32::Shortcut; use File::Copy; if ($OS) { $User = Win32::LoginName(); $Dir2k = c:\\documents and settings\\$User\\desktop; print $Dir2k\n; create2k; } else { $Dir98 = c:\\windows\\desktop; print $Dir98\n; create98; } sub create2k { print Creating the link in 2k\n; my $LINK=new Win32::Shortcut(); $LINK-Path($lldir\\$llexe); $LINK-Arguments(); $LINK-WorkingDirectory($lldir); $LINK-Description('Reports'); #$LINK-ShowCMD(SW_SHOWNORMAL); $LINK-Save($Dir2k\\Reports.lnk); } sub create98 { print Creating the link in 98\n; my $LINK=new Win32::Shortcut(); $LINK-Path($lldir\\$llexe); $LINK-Arguments(); $LINK-WorkingDirectory($lldir); $LINK-Description('Reports'); #$LINK-ShowCMD(SW_SHOWNORMAL); $LINK-Save($Dir98\\Reports.lnk); } # Mark -Original Message- From: Krummel, James C - PGGC-6 [mailto:jckrummel;bpa.gov] Sent: Friday, October 25, 2002 2:47 PM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: Desktop shortcut Mark, Here is a way to make a shortcut to a file or URL using OLE. James use Win32::OLE; $WSH = Win32::OLE-new('Wscript.Shell'); $SC = $WSH-CreateShortcut($WSH-SpecialFolders('AllUsersDesktop').\\Sample.lnk) ; $SC-{WindowStyle} = 4; # 3=Maximized 4=Normal 7=Minimized $SC-{TargetPath} = %windir%\\notepad.exe; $SC-{Hotkey} = ALT+CTRL+N; $SC-Save; -Original Message- From: Ricci, Mark [mailto:mricci;wordwave.com] Sent: Friday, October 25, 2002 8:05 AM To: '[EMAIL PROTECTED]' Subject: Desktop shortcut Hello, Is there a perl module that will automate creating a desktop shortcut? Thanks, Mark ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Desktop shortcut
Thanks for the info, James. I might be able to enhance my script even further with your pointers. Mark -Original Message- From: Krummel, James C - PGGC-6 [mailto:jckrummel;bpa.gov] Sent: Friday, October 25, 2002 4:02 PM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: Desktop shortcut Mark, It should work properly on a Win9x machine, as I asked the OS for the location of the desktop rather then using a hardcoded path, although I do not know if it supports the All Users Desktop tag. Here is a list of most of the standard folders the OS tracks on. Win9x does not support them all, but Win2k does. James use Win32::OLE; $WSH = Win32::OLE-new('Wscript.Shell'); print $ENV{WINDIR}.\n; print $ENV{SYSTEMROOT}.\n; print $WSH-SpecialFolders('AllUsersDesktop').\n; print $WSH-SpecialFolders('AllUsersStartMenu').\n; print $WSH-SpecialFolders('AllUsersPrograms').\n; print $WSH-SpecialFolders('AllUsersStartup').\n; print $WSH-SpecialFolders('Desktop').\n; print $WSH-SpecialFolders('Favorites').\n; print $WSH-SpecialFolders('Fonts').\n; print $WSH-SpecialFolders('MyDocuments').\n; print $WSH-SpecialFolders('NetHood').\n; print $WSH-SpecialFolders('PrintHood').\n; print $WSH-SpecialFolders('Programs').\n; print $WSH-SpecialFolders('Recent').\n; print $WSH-SpecialFolders('SendTo').\n; print $WSH-SpecialFolders('StartMenu').\n; print $WSH-SpecialFolders('Startup').\n; print $WSH-SpecialFolders('Templates').\n; -Original Message- From: Ricci, Mark [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: Desktop shortcut Date: Fri, 25 Oct 2002 14:53:05 -0400 Thanks, James. Will your script work on both Win98 and 2k systems? I ended up using this script due to issues with 98: use Win32::Shortcut; use File::Copy; if ($OS) { $User = Win32::LoginName(); $Dir2k = c:\\documents and settings\\$User\\desktop; print $Dir2k\n; create2k; } else { $Dir98 = c:\\windows\\desktop; print $Dir98\n; create98; } sub create2k { print Creating the link in 2k\n; my $LINK=new Win32::Shortcut(); $LINK-Path($lldir\\$llexe); $LINK-Arguments(); $LINK-WorkingDirectory($lldir); $LINK-Description('Reports'); #$LINK-ShowCMD(SW_SHOWNORMAL); $LINK-Save($Dir2k\\Reports.lnk); } sub create98 { print Creating the link in 98\n; my $LINK=new Win32::Shortcut(); $LINK-Path($lldir\\$llexe); $LINK-Arguments(); $LINK-WorkingDirectory($lldir); $LINK-Description('Reports'); #$LINK-ShowCMD(SW_SHOWNORMAL); $LINK-Save($Dir98\\Reports.lnk); } # Mark -Original Message- From: Krummel, James C - PGGC-6 [mailto:jckrummel;bpa.gov] Sent: Friday, October 25, 2002 2:47 PM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: Desktop shortcut Mark, Here is a way to make a shortcut to a file or URL using OLE. James use Win32::OLE; $WSH = Win32::OLE-new('Wscript.Shell'); $SC = $WSH-CreateShortcut($WSH-SpecialFolders('AllUsersDesktop').\\Sample. lnk) ; $SC-{WindowStyle} = 4; # 3=Maximized 4=Normal 7=Minimized $SC-{TargetPath} = %windir%\\notepad.exe; $SC-{Hotkey} = ALT+CTRL+N; $SC-Save; -Original Message- From: Ricci, Mark [mailto:mricci;wordwave.com] Sent: Friday, October 25, 2002 8:05 AM To: '[EMAIL PROTECTED]' Subject: Desktop shortcut Hello, Is there a perl module that will automate creating a desktop shortcut? Thanks, Mark This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. Any review, use, disclosure or distribution by persons or entities other than the intended recipient(s) is prohibited. If you are not the intended recipient, please contact the sender by reply and destroy all copies of the original message. Thank you. WordWave, Capturing the Power of the Spoken Word http://www.wordwave.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Desktop shortcut
Krummel, James C - PGGC-6 wrote: Mark, It should work properly on a Win9x machine, as I asked the OS for the location of the desktop rather then using a hardcoded path, although I do not know if it supports the All Users Desktop tag. Here is a list of most of the standard folders the OS tracks on. Win9x does not support them all, but Win2k does. James use Win32::OLE; $WSH = Win32::OLE-new('Wscript.Shell'); print $ENV{WINDIR}.\n; print $ENV{SYSTEMROOT}.\n; print $WSH-SpecialFolders('AllUsersDesktop').\n; print $WSH-SpecialFolders('AllUsersStartMenu').\n; print $WSH-SpecialFolders('AllUsersPrograms').\n; print $WSH-SpecialFolders('AllUsersStartup').\n; print $WSH-SpecialFolders('Desktop').\n; print $WSH-SpecialFolders('Favorites').\n; print $WSH-SpecialFolders('Fonts').\n; print $WSH-SpecialFolders('MyDocuments').\n; print $WSH-SpecialFolders('NetHood').\n; print $WSH-SpecialFolders('PrintHood').\n; print $WSH-SpecialFolders('Programs').\n; print $WSH-SpecialFolders('Recent').\n; print $WSH-SpecialFolders('SendTo').\n; print $WSH-SpecialFolders('StartMenu').\n; print $WSH-SpecialFolders('Startup').\n; print $WSH-SpecialFolders('Templates').\n; Slightly modified script and 98 results: use strict; use Win32::OLE; my $WSH = Win32::OLE-new('Wscript.Shell'); print WINDIR = , $ENV{WINDIR} . \n; print SYSTEMROOT = , $ENV{SYSTEMROOT} . \n; print AllUsersDesktop = , $WSH-SpecialFolders('AllUsersDesktop') . \n; print AllUsersStartMenu = , $WSH-SpecialFolders('AllUsersStartMenu') . \n; print AllUsersPrograms = , $WSH-SpecialFolders('AllUsersPrograms') . \n; print AllUsersStartup = , $WSH-SpecialFolders('AllUsersStartup') . \n; print Desktop = , $WSH-SpecialFolders('Desktop') . \n; print Favorites = , $WSH-SpecialFolders('Favorites') . \n; print Fonts = , $WSH-SpecialFolders('Fonts') . \n; print MyDocuments = , $WSH-SpecialFolders('MyDocuments') . \n; print NetHood = , $WSH-SpecialFolders('NetHood') . \n; print PrintHood = , $WSH-SpecialFolders('PrintHood') . \n; print Programs = , $WSH-SpecialFolders('Programs') . \n; print Recent = , $WSH-SpecialFolders('Recent') . \n; print SendTo = , $WSH-SpecialFolders('SendTo') . \n; print StartMenu = , $WSH-SpecialFolders('StartMenu') . \n; print Startup = , $WSH-SpecialFolders('Startup') . \n; print Templates = , $WSH-SpecialFolders('Templates') . \n; __END__ WINDIR = C:\WINDOWS SYSTEMROOT = AllUsersDesktop = AllUsersStartMenu = AllUsersPrograms = AllUsersStartup = Desktop = C:\WINDOWS\Desktop Favorites = C:\WINDOWS\Favorites Fonts = C:\WINDOWS\FONTS MyDocuments = C:\My Documents NetHood = C:\WINDOWS\NetHood PrintHood = C:\WINDOWS\PrintHood Programs = C:\WINDOWS\Start Menu\Programs Recent = C:\WINDOWS\Recent SendTo = C:\WINDOWS\SendTo StartMenu = C:\WINDOWS\Start Menu Startup = C:\WINDOWS\Start Menu\Programs\StartUp Templates = C:\WINDOWS\ShellNew -- ,-/- __ _ _ $Bill Luebkert ICQ=162126130 (_/ / )// // DBE Collectibles Mailto:dbe;todbe.com / ) /-- o // // http://dbecoll.tripod.com/ (Free site for Perl) -/-' /___/__/_/_ Castle of Medieval Myth Magic http://www.todbe.com/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs