smashly Posted December 19, 2006 Posted December 19, 2006 Hi and thank you for taking the time to view my post. I'm wondering how I use ShellExecute using the Verb "properties" on a file or folder. I have been trying for hours now with all sorts of variations to how to call it , but it just doesn't seem to work for me. Some examples of what I've tried below with a file ( tried files from any directory not just notepad): ShellExecute("c:\windows\system32\notepad.exe, "", "", "properties", @SW_SHOW) ShellExecute("c:\windows\system32\notepad.exe, "", "", "properties", "") ShellExecute("c:\windows\system32\notepad.exe, "", "", "properties") ShellExecute("notepad.exe, "", "c:\windows\system32\", "properties", @SW_SHOW) ShellExecute("notepad.exe, "", "c:\windows\system32", "properties", @SW_SHOW) ShellExecute("notepad.exe, "", "c:\windows\system32\", "properties", "") ShellExecute("notepad.exe, "", "c:\windows\system32", "properties") I've tried with folders or files with and without show , minimize , maximize, with and without trailing slash (for folder properties) to call the verb properties and I get the same result every time: There is no associated program , use control panel to associate a program with this file type. I feel like an idiot to ask but could some please give me an example. I'm using Windows XP SP2 , AutoIt beta 3.2.1.14 I just devoted 13 hours (as I'm not always net connected to find the answers) trying to work out why "parameters" and "working directory" fail in ShellExecute only to find it was a bug in the beta autoit (I was using 3.2.1.11). Updated and I really don't feel like going through the same process with the verb "properties" unless need be, so this is why I'm asking for an example. TYIA Cheers
xcal Posted December 19, 2006 Posted December 19, 2006 I feel your pain. I never could get that to work either. I saw someone else ask before, but it went unanswered. gl How To Ask Questions The Smart Way
GEOSoft Posted December 19, 2006 Posted December 19, 2006 (edited) Hi and thank you for taking the time to view my post. I'm wondering how I use ShellExecute using the Verb "properties" on a file or folder. I have been trying for hours now with all sorts of variations to how to call it , but it just doesn't seem to work for me. Some examples of what I've tried below with a file ( tried files from any directory not just notepad): ShellExecute("c:\windows\system32\notepad.exe, "", "", "properties", @SW_SHOW) ShellExecute("c:\windows\system32\notepad.exe, "", "", "properties", "") ShellExecute("c:\windows\system32\notepad.exe, "", "", "properties") ShellExecute("notepad.exe, "", "c:\windows\system32\", "properties", @SW_SHOW) ShellExecute("notepad.exe, "", "c:\windows\system32", "properties", @SW_SHOW) ShellExecute("notepad.exe, "", "c:\windows\system32\", "properties", "") ShellExecute("notepad.exe, "", "c:\windows\system32", "properties") I've tried with folders or files with and without show , minimize , maximize, with and without trailing slash (for folder properties) to call the verb properties and I get the same result every time: There is no associated program , use control panel to associate a program with this file type. I feel like an idiot to ask but could some please give me an example. I'm using Windows XP SP2 , AutoIt beta 3.2.1.14 I just devoted 13 hours (as I'm not always net connected to find the answers) trying to work out why "parameters" and "working directory" fail in ShellExecute only to find it was a bug in the beta autoit (I was using 3.2.1.11). Updated and I really don't feel like going through the same process with the verb "properties" unless need be, so this is why I'm asking for an example. TYIA CheersIt looks like all you are doing is opening a new Notepad window so in reality all you need is Run("Notepad.exe") If you want to open a file that is associated with Notepad then just use ShellExecute("My_File.txt") If its a file type with several verb options and the default verb is something that won't cause notepad to open (au3 files ususlly are set to run and not edit) ShellExecute("my_File.au3","","","Run") Will cause the file to run. Edit: BTW Since I don't use ShellExecute to Run an Exe like you were trying, I'm not positive but I think ShellExecute("NotePad.exe","My_File.au3") will probably open an au3 file in Notepad. Because the File to execute is notepad and the parameter is my_file.au3 Edited December 19, 2006 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
xcal Posted December 19, 2006 Posted December 19, 2006 (edited) GEOSoft... go read about ShellExecute in the help file. He's not simply trying to open a file in notepad. (edit) And 'run' doesn't even look like a valid verb. Edited December 19, 2006 by xcal How To Ask Questions The Smart Way
Uten Posted December 19, 2006 Posted December 19, 2006 Looks like there is a "bug" or maybe inconsistens between the documentation and the implementation. As a woorkaround I think you can use rundll32.exe call. I'll take a look in my notes later on. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
Valik Posted December 19, 2006 Posted December 19, 2006 I can't get anything to work in VBS, either. I tried it on a LNK (shortcut) file in both VBS and AutoIt and while I don't get any errors, I don't get any properties dialog, either.
smashly Posted December 19, 2006 Author Posted December 19, 2006 (edited) It appears ShellExecute still has bugs , or it's just not fully documented in AutoIt help file. Another undocumented part of ShellExecute is no mention of @SW_SHOW is required if you leave any fields blank. eg: ShellExecute("C:\temp\test.txt, "", "","edit","") Would result in your file being launched hidden. This is with any path, any filetype , with or without a verb ...etc. In other words if there is "" and you want your window to show then you need the @SW_SHOW flag. @ GEOSoft thank you , but please reread what I posted as I'm a n00b not a total dummy..lol.. no offence meant. (When I'm not online AutoIt Help file is my bible you could say) @ xcal you are exactly right and cheers m8 Think I'll just leave that "properties" verb out of my hotkey utility I'm making ftm Thank You both for your input it's appreciated. Cheers EDIT Thank to all , geez I'm a slow typer , by the time I typed this there was another 2 responses. Edited December 19, 2006 by smashly
Valik Posted December 19, 2006 Posted December 19, 2006 Another undocumented part of ShellExecute is no mention of @SW_SHOW is required if you leave any fields blank.eg:ShellExecute("C:\temp\test.txt, "", "","edit","")Would result in your file being launched hidden.This is with any path, any filetype , with or without a verb ...etc.In other words if there is "" and you want your window to show then you need the @SW_SHOW flag.This is not true. You didn't leave the "showflag" field empty, you passed "" to it. A non-numeric string will be converted to 0 if it's treated as a number and since the "showflag" field expects a number, it gets turned to 0. It just so happens that the value of @SW_HIDE is 0. So the only reason for the behavior is you told it to do it.
Uten Posted December 19, 2006 Posted December 19, 2006 hmm, I could just swear I have done this once, but I'm not able to find it again. Probably did it from the run dialog (if ever) and then went on.Anyhow, this is a reasonably good read anyone wants to launch control applets and config dialogs. RunDll32.exe shell32.dll,.... Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
smashly Posted December 19, 2006 Author Posted December 19, 2006 Thank You Valik , I stand corrected , now I understand why I was needing @SW_SHOW. Sheesh maby I am a dummy after all , I can't believe I didn't see that considering I've been using "6" for my Minimise flag and "3" for my maximise flag :"> Cheers
GEOSoft Posted December 19, 2006 Posted December 19, 2006 Thank You Valik , I stand corrected , now I understand why I was needing @SW_SHOW.Sheesh maby I am a dummy after all , I can't believe I didn't see that considering I've been using "6" for my Minimise flag and "3" for my maximise flag :"> CheersActually (according to the docs) @SW_SHOW is not even a valid flag for ShellExecute() George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
GEOSoft Posted December 19, 2006 Posted December 19, 2006 (edited) GEOSoft... go read about ShellExecute in the help file. He's not simply trying to open a file in notepad. (edit) And 'run' doesn't even look like a valid verb.If you noticed I was using Run as the verb for an au3 file. Take a look in your registry and you will find that the verb for "Run Script" is "Run". That one I use quite a bit although not with notepad'ShellExecute("My_File.au3","","","Run") is valid Edited December 19, 2006 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
xcal Posted December 19, 2006 Posted December 19, 2006 The run file seems to be shown by default, too. ShellExecute("C:\temp\test.txt", "", "","edit") works just fine for me. (The showflag is optional.) How To Ask Questions The Smart Way
GEOSoft Posted December 19, 2006 Posted December 19, 2006 The run file seems to be shown by default, too. ShellExecute("C:\temp\test.txt", "", "","edit") works just fine for me. (The showflag is optional.)I'm not sure whats up with the Show flag. It's not shown in the ShellExecute docs and I suspect that it either gets ignored or it's interpreted as @SW_NORMAL. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
lod3n Posted December 19, 2006 Posted December 19, 2006 (edited) You don't actually want to do this with ShellExecute. Try this instead:$objShell = ObjCreate("Shell.Application") $objFolder = $objShell.Namespace("C:\WINDOWS\system32") $objFolderItem = $objFolder.ParseName("notepad.exe") $colVerbs = $objFolderItem.Verbs For $objVerb in $colVerbs ConsoleWrite($objVerb.NAME & @CRLF) Next $objFolderItem.InvokeVerb("P&roperties") WinWait("notepad.exe Properties") WinWaitClose("notepad.exe Properties") Edited December 19, 2006 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
Dale2507 Posted June 20, 2007 Posted June 20, 2007 Not had time to read through all of these but maybe it's because of the "" in the comands. If you change these to -1 then it should use the default for the file Deal or No Deal?
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