Jump to content

_ShutdownDialog


layer
 Share

Recommended Posts

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 :dance:

Anyways, if theres anything wrong with it, let me know, because it's my first COM script...

Thanks :D

Func _ShutdownDialog()
   Local $oShell = ObjCreate ("Shell.Application")
   If @error Then Return 0
   $oShell.ShutdownWindows ()
   Return 1
EndFunc ;==>_ShutdownDialog

Example:

Func _ShutdownDialog()
   Local $oShell = ObjCreate ("Shell.Application")
   If @error Then Return 0
   $oShell.ShutdownWindows ()
   Return 1
EndFunc ;==>_ShutdownDialog

_ShutdownDialog()

Enjoi :dance: (purposley spelt enjoi like that, if you skate, you'd know why :D)

EDIT: Updated the code with w0uters modifications. :whistle:

Edited by layer
FootbaG
Link to comment
Share on other sites

Func _ShutdownDialog()
   Local $o_Shell = ObjCreate ("Shell.Application")
   If @error Then Return 0
   $oShell.ShutdownWindows ()
   Return 1
EndFunc;==>_ShutdownDialog

would 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 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

Link to comment
Share on other sites

Func _ShutdownDialog()
   Local $o_Shell = ObjCreate ("Shell.Application")
   If @error Then Return 0
   $oShell.ShutdownWindows ()
   Return 1
EndFunc;==>_ShutdownDialog

would be better acording to the helpfile.

<{POST_SNAPBACK}>

Should not that be Local $oShell = ObjCreate ("Shell.Application") as to the underscore removed?
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Oops ! Thanks guys :(

@Mhz,

I changed the variable name, and forgot to change the local too :dance: Thanks for pointing that out :dance:

@w0uter,

Thanks for pointing that out, I guess I missed that :"> Thanks for cleaning it up too :D

Thanks guys. Appreciate it ! :whistle:

EDIT: Oh yea, I usually prefer to use no underscore for variables, but like w0uter said, I don't think it matters.

Edited by layer
FootbaG
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...