From: SourceForge.net <no...@so...> - 2010-12-07 08:24:19
|
Support Requests item #3124287, was opened at 2010-12-01 07:25 Message generated for change (Comment added) made by mheihs You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=684731&aid=3124287&group_id=119701 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: APIs Group: Windows: WSH, WSC, WSF Status: Open Priority: 5 Private: No Submitted By: Michael K. J. Heihs (mheihs) Assigned to: Mark Miesfeld (miesfeld) Summary: WindowsProgramManager~AddShortcut Initial Comment: WindowsProgramManager~AddShortcut works fine with "Windows 7 64-bit" and "ooRexx 4.1 Beta" but is there a way to read the definitions of a shortcut into e.g. a Directory ??? I want to modify certain shortcuts, therefore I have to look at the definitions first. ---------------------------------------------------------------------- >Comment By: Michael K. J. Heihs (mheihs) Date: 2010-12-07 09:24 Message: Thx for your comment, I gave it a try, and it worked perfectly- The only lack is, to get the info about the Icon. Do you have also a solution for this? ---------------------------------------------------------------------- Comment By: Mark Miesfeld (miesfeld) Date: 2010-12-01 20:40 Message: I spoke too quickly. You can use the OLEObject.to get a short cut object. The short cut object will look similar to a Directory object when you use it to access the properties. Here is an example program that lists the properties of 3 short cuts. For the second short cut, you will need to copy a short cut into the current directory where you execute the program. Then change the line: folderItem = folder~parseName("Right Command Prompt.lnk") to use the name of your short cut, instead of "Rigth Command Prompt.lnk" In the beginning of the program I don't do much error checking, but it should work for the Internet Explorer short cut, unless you have deleted if from your Start Menu. The Shell object can be used to create short cuts also. The Windows Shell is likely to work better than the obsolete Program Manager. But, it takes some research with trial and error testing to work out the details. /* shortCut.rex Rexx program using the OLEObject. */ shell = .OleObject~new("Shell.Application") ssfPROGRAMS = 2 folder = shell~NameSpace(ssfPROGRAMS) folderItem = folder~ParseName("Internet Explorer.lnk") -- The shell link is the short cut object. The properties of the short cut -- are those printed out. shellLink = folderItem~GetLink say 'shellLink:' shellLink 'name:' folderItem~name say ' working directory:' shellLink~workingDirectory say ' path: ' shellLink~path say ' arguments: ' shellLink~arguments say ' description: ' shellLink~description say ' hot key: ' shellLink~hotKey say ' show command: ' shellLink~showCommand say folder = shell~nameSpace(directory()) folderItem = folder~parseName("Right Command Prompt.lnk") shortCut = folderItem~getLink say 'ShellLink:' shortCut 'name:' folderItem~name say ' working directory:' shortCut~workingDirectory say ' path: ' shortCut~path say ' arguments: ' shortCut~arguments say ' description: ' shortCut~description say ' hot key: ' shortCut~hotKey say ' show command: ' shortCut~showCommand say ssfCOMMONPROGRAMS = 23 folder = shell~nameSpace(ssfCOMMONPROGRAMS) folderItems = folder~items ooRexxFolder = .nil do item over folderItems say "item:" item~name if item~name = "Open Object Rexx" then do ooRexxFolder = item leave end end say if ooRexxFolder == .nil then do say "Failed to get the ooRexx folder in the Start Menu, have to quit." return end if ooRexxFolder~isFolder then do ooRexxFolder = ooRexxFolder~getFolder end else do say "Got something for the ooRexx folder, but it is not a folder, have to quit" return end folderItem = ooRexxFolder~parseName("Try Rexx (GUI).lnk") shortCut = folderItem~getLink say 'ShellLink:' shortCut 'name:' folderItem~name say ' working directory:' shortCut~workingDirectory say ' path: ' shortCut~path say ' arguments: ' shortCut~arguments say ' description: ' shortCut~description say ' hot key: ' shortCut~hotKey say ' show command: ' shortCut~showCommand say ---------------------------------------------------------------------- Comment By: Mark Miesfeld (miesfeld) Date: 2010-12-01 18:18 Message: The short answer is no, not with ooRexx. WindowsProgramManager provides access to Program Manager through DDE. Program Manager was the graphical shell for Windows 3.0 and 3.1. The fact that this still works at all in Windows 7 is due to Microsoft still maintaing backward compatibility. I don't see any hint that the ability to read the properties of a short cut through Program Manager was ever provided. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=684731&aid=3124287&group_id=119701 |