Yeik Posted February 28, 2008 Share Posted February 28, 2008 Is it possible, besides telling autoit to run a program in notepad, that if it doesn't have an extension to have it run, and bring up the open with dialog from windows to allow you to select what you want to run the file? func get_quote() local $quote switch random(1, 3, 1) case 1 $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _ "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _ "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _ "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein" case 2 $quote = '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _ "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)" case 3 $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein" EndSwitch MsgBox(0, "Quote for the moment", $quote & @CRLF) EndFunc get_quote() Link to comment Share on other sites More sharing options...
someone Posted February 28, 2008 Share Posted February 28, 2008 (edited) There may be a more intelligent way to do this, I thought shellexecute would work, but anyway.... this will prompt the open dialog box that will normally open up if you double-click a file with no extension. I think thats what you are asking for. This opens a file 'text'. Run(@ComSpec & " /c " & "start text", "", @SW_HIDE)oÝ÷ ØGb´ ®É ¢%yƦzêpØm+²Ç§¶&¥+azƦy»Êjvò¥«,ºÈ§Ø^r¦jwi®©µ«¢+ÙM¡±±áÕÑ ÅÕ½ÐíÉÕ¹±°ÌȹáÅÕ½Ðì°ÅÕ½ÐíÍ¡±°Ìȹ±°°=Á¹Í}IÕ¹10ÑáÐÅÕ½Ðì¤ Edited February 28, 2008 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Yeik Posted February 28, 2008 Author Share Posted February 28, 2008 There may be a more intelligent way to do this, I thought shellexecute would work, but anyway.... this will prompt the open dialog box that will normally open up if you double-click a file with no extension. I think thats what you are asking for. This opens a file 'text'. Run(@ComSpec & " /c " & "start text", "", @SW_HIDE)oÝ÷ ØGb´ ®É ¢%yƦzêpØm+²Ç§¶&¥+azƦy»Êjvò¥«,ºÈ§Ø^r¦jwi®©µ«¢+ÙM¡±±áÕÑ ÅÕ½ÐíÉÕ¹±°ÌȹáÅÕ½Ðì°ÅÕ½ÐíÍ¡±°Ìȹ±°°=Á¹Í}IÕ¹10ÑáÐÅÕ½Ðì¤ thanks, that works well, I ended up of course changing it slightly. Do you happen to know an easy way to query the registry for extension associations and the programs to open them? CODEShellExecute("rundll32.exe", "shell32.dll, OpenAs_RunDLL " & $filename) func get_quote() local $quote switch random(1, 3, 1) case 1 $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _ "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _ "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _ "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein" case 2 $quote = '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _ "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)" case 3 $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein" EndSwitch MsgBox(0, "Quote for the moment", $quote & @CRLF) EndFunc get_quote() 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