layer Posted August 29, 2005 Posted August 29, 2005 (edited) First COM script/UDF comin' through here, make way Well, I was browsing here and decided to try it in AutoIt.Then, after creating it, it took me about 10 minutes to figure out why it wasn't working. Because I didn't even call the function, I just ran basically nothing Anyways, if theres anything wrong with it, let me know, because it's my first COM script...Thanks Func _ShutdownDialog() Local $oShell = ObjCreate ("Shell.Application") If @error Then Return 0 $oShell.ShutdownWindows () Return 1 EndFunc ;==>_ShutdownDialogExample:Func _ShutdownDialog() Local $oShell = ObjCreate ("Shell.Application") If @error Then Return 0 $oShell.ShutdownWindows () Return 1 EndFunc ;==>_ShutdownDialog _ShutdownDialog()Enjoi (purposley spelt enjoi like that, if you skate, you'd know why )EDIT: Updated the code with w0uters modifications. Edited August 29, 2005 by layer FootbaG
MHz Posted August 29, 2005 Posted August 29, 2005 Looks quite good, layer. btw. What does $vObjShell do?
w0uter Posted August 29, 2005 Posted August 29, 2005 (edited) Func _ShutdownDialog() Local $o_Shell = ObjCreate ("Shell.Application") If @error Then Return 0 $oShell.ShutdownWindows () Return 1 EndFunc;==>_ShutdownDialogwould be better acording to the helpfile.Always check on errors using @error after a ObjGet(). Do not use IsObj() because the object variable will not be assigned a value upon an error. Edited August 29, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
MHz Posted August 29, 2005 Posted August 29, 2005 Func _ShutdownDialog() Local $o_Shell = ObjCreate ("Shell.Application") If @error Then Return 0 $oShell.ShutdownWindows () Return 1 EndFunc;==>_ShutdownDialogwould be better acording to the helpfile.<{POST_SNAPBACK}>Should not that be Local $oShell = ObjCreate ("Shell.Application") as to the underscore removed?
w0uter Posted August 29, 2005 Posted August 29, 2005 actually it should be $oShell.ShutdownWindows () to $o_Shell.ShutdownWindows () but thats just my notation. the UDF doc doesnt really say it should be a certain way. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
layer Posted August 29, 2005 Author Posted August 29, 2005 (edited) Oops ! Thanks guys @Mhz,I changed the variable name, and forgot to change the local too Thanks for pointing that out @w0uter,Thanks for pointing that out, I guess I missed that :"> Thanks for cleaning it up too Thanks guys. Appreciate it ! EDIT: Oh yea, I usually prefer to use no underscore for variables, but like w0uter said, I don't think it matters. Edited August 29, 2005 by layer FootbaG
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