The Kandie Man Posted July 18, 2005 Share Posted July 18, 2005 (edited) I just recently started programming and i am not very far into it yet. I just recently learned about autoit and i have made many programs. I am stuck now and i am not sure what to do. What i want is my script (when compiled) to open up files when a user double clicks a file with the extension .asdf. If the user double clicks a file, then the OS sends the .exe script instructions to open the file that the user has just double clicked. I don't know what this is called or how the program listens for the instructions the OS gives it. I was just wondering if such a thing was possible. Here is a look at the very basic program i wrote. I wrote it for MSN Messenger in case you were wondering since new versions don't allow the sending of many file types. It works by renaming files that have names like "setup.exe.asdf" to "setup.exe" #include <GUIConstants.au3> GUISetState () While 1;Don't even need since it doesn't loop but i do it anyway out of habit;) $msg = GUIGetMsg () $file = FileOpenDialog("Open", @MyDocumentsDir & "\My Received Files\", "ASDF (*.asdf)") $len = StringLen($file); Get the length of the file $truefilenamelength = $len - 5; Remove last 5 digits or .asdf $actualfilename = StringLeft($file, $truefilenamelength); Count only characters of actual file excluding asdf FileCopy ($file, $actualfilename); copy the file to rename it FileRecycle ( $file );delete the file with the extension asdf exit Wend The program works, but it opens an open dialogue when the user double clicks the file they want to open. I want the program not to even show a dialogue if possible. Please help Edited July 18, 2005 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
w0uter Posted July 18, 2005 Share Posted July 18, 2005 what version do you have. try the beta. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted July 18, 2005 Share Posted July 18, 2005 You could compile it as an exe, and associate the asdf extension to the executable...I'm not 100% sure it will open the file (instead of file dialog), but it might...you could also check cmdline params to see if it is passed there... Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
The Kandie Man Posted July 18, 2005 Author Share Posted July 18, 2005 (edited) I have autoit v3.1.1. I have associated all .asdf files on my computer with a compiled .exe of the script above. When i double click an .asdf file on my computer, it opens the compiled script above(.exe form), but the executable above doesn't open the file. I have looked and i can't find anything that can do this or at least don't know the name. Is there a function or a parameter that listens to see if the OS is giving it the location of a file to open when it runs. What i am trying to do is make my program open .asdf files like Word opens .doc files, but i don't know how to make the script do that. Edited July 18, 2005 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
Helge Posted July 18, 2005 Share Posted July 18, 2005 Search the helpfile for $CMDLine.. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted July 18, 2005 Share Posted July 18, 2005 (edited) I just tested it, give me a minute and I'll write up a few lines of code that you'll want If $CmdLine[0] > 0 Then $file = $CmdLine[1] Else $file = FileOpenDialog("Open", @MyDocumentsDir & "\My Received Files\", "ASDF (*.asdf)") EndIf FileMove($file, StringTrimRight($file, 5), 1) I have to apologize now, I had to clean up the code, I just can't stand using a sledgehammer to get a nail through a piece of wood Edited July 18, 2005 by MSLx Fanboy Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
The Kandie Man Posted July 18, 2005 Author Share Posted July 18, 2005 Yes, you guys got at what i wanted. Thx a bunch, been up all night trying to figure it out. Just didn't know what it was called. Thank you to MSLx Fanboy for writing code. Like i said, i am a newbie and the best way i learn is looking at other peoples work and examples in the help file. So far this has been the only thing that has stumped me. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted July 18, 2005 Share Posted July 18, 2005 Just finished the code, look at my previous post (#6) Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
The Kandie Man Posted July 18, 2005 Author Share Posted July 18, 2005 Thx again. Sorry about the mess i made. Like i said, i am a newbie. Thanks for helping me. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted July 18, 2005 Share Posted July 18, 2005 My pleasure. Keep working on some scripts, it makes it much easier to understand logic... (loops, conditionals, etc) Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) 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