ezzetabi Posted August 31, 2004 Share Posted August 31, 2004 (edited) ;better code below. Edit: Fixed a comple of bug. 1- lnkfile strangely have no Open key in the registry 2- it will work also if a user do not set a extension, but it set the path. Edited September 3, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
ezzetabi Posted August 31, 2004 Author Share Posted August 31, 2004 You can also use non default right click menu actions, like print, enqueue... Link to comment Share on other sites More sharing options...
this-is-me Posted August 31, 2004 Share Posted August 31, 2004 Could you add a run or runwait parameter? EG: _ShellExecute('www.hiddensoft.com\forum','', 1) to wait on iexplore or the program to finish? Who else would I be? Link to comment Share on other sites More sharing options...
ezzetabi Posted August 31, 2004 Author Share Posted August 31, 2004 (edited) With easy: ;Better code below. Edit: corrected the same bugs :"> Edited September 3, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
ezzetabi Posted September 1, 2004 Author Share Posted September 1, 2004 (edited) New version. This time it can also execute 'Registry shortcut' (HKCR\Applications application with Open key) and should be more read able than the older version... Well. A part of this-is-me him/herself none answered. So I guess it is unimportant... Anyway, adding the $wait thing is very easy if needed. Just take the pid of the process Run() create and at the very end await it closes. Since it is a 'not-so-often' needed feature. You may activate it when, for example, StringRight($line,6) = '\\wait' . And remove this \\wait just a little after. So it becomes a optional parameter! Example code: If StringRight($line,6) = '\\wait' Then $wait = 1 $line = StringTrimRight($line,6) EndIf At the end of the script adds something like If $wait = 1 Then ProcessWaitClose($pid) ;Better code below Edit: since this version has been remade from zero I forgot the strange thing of .lnk file that have no Open key in the registry. Corrected! Edited September 3, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
this-is-me Posted September 1, 2004 Share Posted September 1, 2004 I'm a he. I don't think it is unimportant to most people, just most people don't know the main reason for having such a function. I personally use it many times during the day. If the real reasoning behind this udf were known, I think noobs would flock to it with open arms and hearts full of joy. Who else would I be? Link to comment Share on other sites More sharing options...
tuape Posted September 1, 2004 Share Posted September 1, 2004 I'm a he. I don't think it is unimportant to most people, just most people don't know the main reason for having such a function. I personally use it many times during the day. If the real reasoning behind this udf were known, I think noobs would flock to it with open arms and hearts full of joy. <{POST_SNAPBACK}>Can you share the reason with us? It might be interesting to know how other people use it and it could give ideas to the rest of us... Link to comment Share on other sites More sharing options...
ezzetabi Posted September 2, 2004 Author Share Posted September 2, 2004 Thanks you this-is-me. I am happy now. Link to comment Share on other sites More sharing options...
this-is-me Posted September 2, 2004 Share Posted September 2, 2004 @tuape, The shellexecute function allows you to "execute" a file without knowing what program it is associated with. Therefore, instead of running notepad.exe testfile.txt you can just shellexecute testfile.txt and shellexecute will find what program needs to be opened and open it for you. You can do the same with msi files, etc. The main reason you might need shellexecute is if you were starting a file on another person's computer and you don't know what program they want it to run in. Example: You want to open a webpage. You try to run firefox.exe mypage.htm Firefox doesn't exist on the target computer. Your script blows up. Example fixed with shellexecute: You want to open a webpage. You shellexecute mypage.htm The page opens in their default browser Fixed! @ezzetabi, no prob. Who else would I be? Link to comment Share on other sites More sharing options...
ezzetabi Posted September 2, 2004 Author Share Posted September 2, 2004 (edited) Improved even more! Now it is even more powerful than the standard Shell! Before this update using * or ? could crash the scipt (if errorsfatal isnt set), now instead if the file appear to exist, but you used * or ?, the first file that is found with that wildcards will be open! E.g. you have a program called C:\program files\hello_world.exe you can run it only with "c:\program files\hello_*.exe" If the file using *, ? seems not exist, it will be searched using the old code, that actually already worked! E.g. you can start your console with cm?.exe since the program will look for a the first file that is cm?.exe in the whole %path%. Registry shortcut can't be used with wildcards. Edited September 2, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
SumTingWong Posted September 3, 2004 Share Posted September 3, 2004 (edited) Try Run(@SystemDir & "\RUNDLL32.EXE shell32.dll,ShellExec_RunDLL """ & $sCmd & """") If you want a quick and easy way of calling ShellExecute Edited September 3, 2004 by pacman Link to comment Share on other sites More sharing options...
ezzetabi Posted September 3, 2004 Author Share Posted September 3, 2004 (edited) Well. It is a great idea PacMan, but it does not accept arguments (AFAI saw) and it can't work with partial filenames. Edit: I checked better, it accepts arguments. But still the missing ability of the '$verb' ability is bad. Still, if you dont need verbs a single line agaist this big UDF can be a good deal. Edited September 3, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
this-is-me Posted September 3, 2004 Share Posted September 3, 2004 Also, that command only works on 2k or above. Who else would I be? Link to comment Share on other sites More sharing options...
m0n5ter Posted September 3, 2004 Share Posted September 3, 2004 Hi I am new to this whole AutoIt, and am writing my first decent script. I have a script that will exit filemaker pro, format a floppy, zip the user files to the floppy, and then finally asks if the user woul dlike to restart Filemaker Pro. I though using this function I could easily do this, but Filemaker Pro starts when I use: _ShellExecute('file.fp5','','') But the file itself does not open. Just the dialogue box for New File, Load Existing, Blank Document thing. Any ideas? Thanks Monster Link to comment Share on other sites More sharing options...
ezzetabi Posted September 3, 2004 Author Share Posted September 3, 2004 (edited) ...Strange. Can you look in registry the key that this func should execute? BTW: The registry shortcut are stored in HKLM\SOFTWARE\ Microsoft\Windows\ CurrentVersion\App Paths\filename.exe not in HKCR\Applications\filename.exe\shell\open\command as I thought... Correcting the script right now. Edited September 3, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
m0n5ter Posted September 3, 2004 Share Posted September 3, 2004 ...Strange. Can you look in registry the key that this func should execute? BTW: The registry shortcut are stored in HKLM\SOFTWARE\ Microsoft\Windows\ CurrentVersion\App Paths\filename.exe not in HKCR\Applications\filename.exe\shell\open\command as I thought... Correcting the script right now. <{POST_SNAPBACK}>It correctly shows Filemaker Pro.exe If I double click the file it loads. HTH Monster Link to comment Share on other sites More sharing options...
ezzetabi Posted September 3, 2004 Author Share Posted September 3, 2004 There is only the .exe name? No %1 or %L ? Link to comment Share on other sites More sharing options...
m0n5ter Posted September 3, 2004 Share Posted September 3, 2004 There is only the .exe name? No %1 or %L ? <{POST_SNAPBACK}>In HKCR\Applications\filename.exe\shell\open\command There is a %1 You asked me to check HKLM\SOFTWARE\ Microsoft\Windows\ CurrentVersion\App Paths\filename.exe HTH Link to comment Share on other sites More sharing options...
ezzetabi Posted September 3, 2004 Author Share Posted September 3, 2004 (edited) No. Do you see how the udf works? Look for the category name in the HKCR\.fp5 it is probably fp5file, look in HKCR\fp5file\Shell\open\Command . Thats the point where the udf should look for. And it replaces %1 or %l with the filename. The btw command was a note. There was a error in the UDF managing the registry shortcut, I posted the fixed code. Edited September 3, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
m0n5ter Posted September 3, 2004 Share Posted September 3, 2004 Can you see why it is not working? Is it because the application has a space in it's name? "Filemaker Pro.exe" I have attached a screenshot of my REGEDIT screen showing the items you asked about. Cheers Monster 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