kaotkbliss Posted August 19, 2010 Share Posted August 19, 2010 I did some searching on the forums but often times pages could not load (maybe the site simply does not like this subject?) I found very few responses and tried them all Func _ShowFileProperties($sFile, $sVerb = "properties", $hWnd = 0) ; function by Rasim ; http://www.autoitscript.com/forum/index.php?showtopic=78236&view=findpost&p=565547 Local Const $SEE_MASK_INVOKEIDLIST = 0xC ; Local Const $SEE_MASK_NOCLOSEPROCESS = 0x40 ; Local Const $SEE_MASK_FLAG_NO_UI = 0x400 Local $PropBuff, $FileBuff, $SHELLEXECUTEINFO $PropBuff = DllStructCreate("char[256]") DllStructSetData($PropBuff, 1, $sVerb) $FileBuff = DllStructCreate("char[256]") DllStructSetData($FileBuff, 1, $sFile) $SHELLEXECUTEINFO = DllStructCreate("int cbSize;long fMask;hwnd hWnd;ptr lpVerb;ptr lpFile;ptr lpParameters;ptr lpDirectory;" & _ "int nShow;int hInstApp;ptr lpIDList;ptr lpClass;hwnd hkeyClass;int dwHotKey;hwnd hIcon;" & _ "hwnd hProcess") DllStructSetData($SHELLEXECUTEINFO, "cbSize", DllStructGetSize($SHELLEXECUTEINFO)) DllStructSetData($SHELLEXECUTEINFO, "fMask", $SEE_MASK_INVOKEIDLIST) DllStructSetData($SHELLEXECUTEINFO, "hwnd", $hWnd) DllStructSetData($SHELLEXECUTEINFO, "lpVerb", DllStructGetPtr($PropBuff, 1)) DllStructSetData($SHELLEXECUTEINFO, "lpFile", DllStructGetPtr($FileBuff, 1)) $aRet = DllCall("shell32.dll", "int", "ShellExecuteEx", "ptr", DllStructGetPtr($SHELLEXECUTEINFO)) If $aRet[0] = 0 Then Return SetError(2, 0, 0) Return $aRet[0] EndFunc ;==>_ShowFileProperties This code works fine in XP which is great because the more OS I can support with my script, the better However every option I found and tried has simply done nothing on windows 7 (64bit) I have a gui that has paths to exe files stored. I want to be able to select a path and click a button to open that exe's properties window. Everything is all ready except the command to open the properties window 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 19, 2010 Share Posted August 19, 2010 If ShellExecute doesn't work for you, there are two alternatives: One using COM objects: $sPath = @SystemDir&"\user32.dll" $oshellApp = ObjCreate("shell.application") $oshellApp.namespace(0).parsename($sPath).invokeverb("Properties") Sleep(2000) ; The Properties page will display and disappear if your program exits (it somehow attaches to this process) One using SHObjectProperties: Global Const $SHOP_PRINTERNAME=1 ; $sObjName = printer friendly name Global Const $SHOP_FILEPATH=2 ; $sObjName = full pathname to file Global Const $SHOP_VOLUMEGUID=4 ; $sObjName = Drive Path ("C:\") or Volume GUID ("\\?\Volume\{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\)") Func _FilePropertiesDialog($sObjName,$sPropPage="",$iObjType=0x02,$hWnd=0) Local $sPropPageType="ptr" If IsString($sPropPage) And $sPropPage<>"" Then $sPropPageType="wstr" Else $sPropPage=0 EndIf Local $aRet=DllCall("shell32.dll","bool","SHObjectProperties","hwnd",$hWnd,"dword",$iObjType,"wstr",$sObjName,$sPropPageType,$sPropPage) If @error Then Return SetError(2,@error,False) If Not $aRet[0] Then Return SetError(3,0,False) Return True EndFunc _FilePropertiesDialog("C:\","",4) ; Drive/Volume Properties - this special case does not return until closed by the User _FilePropertiesDialog("Microsoft XPS Document Writer","",1) ; Printers ConsoleWrite("@error="&@error&", @extended="&@extended&@CRLF) Sleep(2000) ; The Properties page will display and disappear if your program exits (it somehow attaches to this process) _FilePropertiesDialog(@ComSpec,"Version",2) ; File ConsoleWrite("@error="&@error&", @extended="&@extended&@CRLF) Sleep(2000) ; The Properties page will display and disappear if your program exits (it somehow attaches to this process) Note how both options will close once the program is closed - this is why you should do what you need to do with the dialog boxes, and then close them. The odd case is drives, from which it doesn't return until closed by the user. A nice thing about the second option is that you can select which Property tab displays (I gave 'Version' as an example, but you can leave it as "" to display the default tab). Anyway, hope it helps alienclone 1 My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 19, 2010 Author Share Posted August 19, 2010 (edited) I will definately try them, Thanks! I tried the shellexecute and when it didn't work searched on the forums to find out that it is flawed and the "properties" value is wrong. Would have made everything so much easier. *edit* the first example you have a comment saying "it attaches itself to this proccess" are you refering to the autoit script that calls the object or the exe you are viewing the properties window of? Edited August 19, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 19, 2010 Share Posted August 19, 2010 I meant the AutoIt script's Process (whether it is a compiled script or running through autoit3). You'll see if you run the code as it is - the dialogs just disappear on script exit. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 19, 2010 Author Share Posted August 19, 2010 I figured but it looked similar to one I tried before (found through search) and either it opened and closed the window so fast I couldn't tell, or nothing happened at all (I didn't see any sign that anything happened) Anyways, I will try it, hope it works and report results. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 19, 2010 Share Posted August 19, 2010 (edited) Actually, I've successfully gotten this to work with my own ShellExecuteEx function on Windows 7 (modified from MrCreatoR's post on ShellExecuteEx [warning: the original is not Unicode or x64 safe]).The Properties dialog actually has the same problem as the other methods I mentioned, so that's not really a shortcoming of any method I suppose - just the way Windows works.I believe AutoIt's ShellExecute is simply missing the 'SEE_MASK_INVOKEIDLIST' flag bits (0x0C). Once they fix that in a future version, we won't need all these workarounds.*edit: by shortcoming, I meant - it closes when the script does Edited August 19, 2010 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 19, 2010 Author Share Posted August 19, 2010 If ShellExecute doesn't work for you, there are two alternatives: One using COM objects: $sPath = @SystemDir&"\user32.dll" $oshellApp = ObjCreate("shell.application") $oshellApp.namespace(0).parsename($sPath).invokeverb("Properties") Sleep(2000) ; The Properties page will display and disappear if your program exits (it somehow attaches to this process) This one seems to have worked just fine 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
MilesAhead Posted November 4, 2011 Share Posted November 4, 2011 ...A nice thing about the second option is that you can select which Property tab displays (I gave 'Version' as an example, but you can leave it as "" to display the default tab).... _FILEPropertiesDialog() is very useful. Adding to my collection. Thanks for posting it. My Freeware Page Link to comment Share on other sites More sharing options...
DrLarch Posted April 10, 2013 Share Posted April 10, 2013 OK, resurrecting old thread - can't find a solution that works for opening a scheduled task's properties window (C:WindowsTasks<example>.job). Tried all the above suggestions with no luck and also ShellExecuteEx as well. This one seems to be difficult... Link to comment Share on other sites More sharing options...
KaFu Posted April 10, 2013 Share Posted April 10, 2013 This one does the job for me, but has the same issues as the examples posted before, the properties window only exists as long as the script is running... expandcollapse popup$sFile = "C:\WINDOWS\Tasks\Adobe Flash Player Updater.job" ConsoleWrite(FileExists($sFile) & @CRLF) ConsoleWrite(_ShowFileProperties($sFile) & @CRLF) Sleep(5000) Func _ShowFileProperties($sFile, $sVerb = "properties", $hWnd = 0) ; function by Rasim ; http://www.autoitscript.com/forum/index.php?showtopic=78236&view=findpost&p=565547 ; http://stackoverflow.com/questions/12508100/shellexecuteinfo-unicode-support Local Const $SEE_MASK_INVOKEIDLIST = 0xC Local Const $SEE_MASK_NOCLOSEPROCESS = 0x40 Local Const $SEE_MASK_FLAG_NO_UI = 0x400 Local $PropBuff, $FileBuff, $SHELLEXECUTEINFO $PropBuff = DllStructCreate("wchar[256]") DllStructSetData($PropBuff, 1, $sVerb) $FileBuff = DllStructCreate("wchar[4096]") DllStructSetData($FileBuff, 1, $sFile) $SHELLEXECUTEINFO = DllStructCreate("int cbSize;long fMask;hwnd hWnd;ptr lpVerb;ptr lpFile;ptr lpParameters;ptr lpDirectory;" & _ "int nShow;int hInstApp;ptr lpIDList;ptr lpClass;hwnd hkeyClass;int dwHotKey;hwnd hIcon;" & _ "hwnd hProcess") DllStructSetData($SHELLEXECUTEINFO, "cbSize", DllStructGetSize($SHELLEXECUTEINFO)) DllStructSetData($SHELLEXECUTEINFO, "fMask", $SEE_MASK_INVOKEIDLIST) DllStructSetData($SHELLEXECUTEINFO, "hwnd", $hWnd) DllStructSetData($SHELLEXECUTEINFO, "lpVerb", DllStructGetPtr($PropBuff, 1)) DllStructSetData($SHELLEXECUTEINFO, "lpFile", DllStructGetPtr($FileBuff, 1)) $aRet = DllCall("shell32.dll", "int", "ShellExecuteExW", "ptr", DllStructGetPtr($SHELLEXECUTEINFO)) If $aRet[0] = 0 Then Return SetError(2, 0, 0) Return $aRet[0] EndFunc ;==>_ShowFileProperties OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
DrLarch Posted April 10, 2013 Share Posted April 10, 2013 Thanks KhaFoo!! Does the trick for me... Link to comment Share on other sites More sharing options...
Starstar Posted April 11, 2013 Share Posted April 11, 2013 (edited) See windows shortcut keys....................Alt+Enter to get properties of selected item.............windows key + pause to get system property. Edited April 11, 2013 by adnanbaloch Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now