Skrip Posted March 30, 2006 Share Posted March 30, 2006 (edited) Scroll down... expandcollapse popup#NoTrayIcon HotKeySet("{F9}", "_create") HotKeySet("!{F9}", "eexit") While 1 sleep(100) WEnd Func eexit() Exit EndFunc Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Dim $pos, $ret, $ret27 $pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc;==>_GuiRoundCorners #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.5 Prototype Func _Create() #include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 $AA = GuiCreate("AA", 169, 217,1, 1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) _GuiRoundCorners($AA, 0, 0, 50, 50) $Button_1 = GuiCtrlCreateButton("Pass", 20, 80, 70, 20) $Button_2 = GuiCtrlCreateButton("Refresh AA", 50, 10, 70, 20) $Button_3 = GuiCtrlCreateButton("Close All", 90, 80, 60, 20) $Button_4 = GuiCtrlCreateButton("Shutdown", 0, 30, 70, 20) $Button_5 = GuiCtrlCreateButton("Restart", 110, 30, 60, 20) $Group_6 = GuiCtrlCreateGroup("Functions", 10, 60, 150, 110) $Button_7 = GuiCtrlCreateButton("Close", 10, 180, 150, 30) $Button_8 = GuiCtrlCreateButton("Control Center", 20, 110, 130, 20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Run("pass.exe", "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\") Case $msg = $Button_2 ProcessClose("auto-acticate.exe") Run("auto-activate.exe", "C:\Pass") Case $msg = $Button_3 Sleep(60) Case $msg = $Button_4 $Shutdown_c = 1 $shut_com = MsgBox(4, "Shutdown?", "Are you sure you want to shutdown?") If $shut_com = 7 Then $Shutdown_c = 0 EndIf If $Shutdown_c = 1 Then Shutdown(13) EndIf Case $msg = $Button_5 $restart_c = 1 $shut_com = MsgBox(4, "Restart?", "Are you sure you want to restart?") If $restart_com = 7 Then $restart_c = 0 EndIf If $restart_c = 1 Then Shutdown(6) EndIf Case $msg = $Button_7 GUIDelete("AA") ProcessClose("auto-acticate.exe") Run("auto-activate.exe", "C:\Pass") Sleep(60) Case $msg = $Button_8 Run("Pass_command_center.exe", "C:\pass\") EndSelect WEnd Exit #endregion --- GuiBuilder generated code End --- EndFunc When you press F-9 The gui will pop-up, I can't get the 'close' button to work. When you click the 'close' button the gui should go away but not the script, so when you press F-9 again after clicking close it will just re-open. On the 're-open'ing stage i get this error: C:\AutoIt3\Include\GuiConstants.au3 (13) : ==> Cannot make existing variables into constants.: Global Const $GUI_EVENT_CLOSE = -3 Global Const ^ ERROR Even when trying beta autoit. Please help! Edited March 30, 2006 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
Skrip Posted March 30, 2006 Author Share Posted March 30, 2006 EDITED; edited button 3 due to external file [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
GaryFrost Posted March 30, 2006 Share Posted March 30, 2006 to start with move your include to the top of the script --> #include <GuiConstants.au3> SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Skrip Posted March 30, 2006 Author Share Posted March 30, 2006 (edited) I'm sorry, but do what exactly? Edited March 30, 2006 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
billmez Posted March 30, 2006 Share Posted March 30, 2006 Is this a typo: ProcessClose("auto-acticate.exe") Run("auto-activate.exe", "C:\Pass") Try declaring #include <GuiConstants.au3> at the top of the script not in the function, or try include once. Link to comment Share on other sites More sharing options...
GaryFrost Posted March 30, 2006 Share Posted March 30, 2006 I'm sorry, but do what exactly?you have that include statement inside the function _Create() it should be at the top of the script. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
greenmachine Posted March 30, 2006 Share Posted March 30, 2006 (edited) What is in your "close them up.au3" file? Does it happen to include GUIconstants.au3 or have $GUI_EVENT_CLOSE defined in that script? If so, that's likely your error. Also, general scripting advice: put all includes and global vars at the top - includes are going to be included regardless of where you put them, so it just makes it easier to find them all when they're at the top. Global vars don't like being created from within functions, so it's also good practice to put them up there too (this doesn't appear to apply to you, just a word of warning for in the future). The GuiDelete function takes in a GUI handle, not the title of the GUI. Not sure if that's your issue, but you should also consider it. ProcessClose("auto-acticate.exe") Run("auto-activate.exe", "C:\Pass") I'm assuming your process close is the one spelled wrong. It's in multiple places. Also, about running things, I don't believe workingdir affects the path of the file as you want it to. What you should do instead is to just do: Run ("C:\Pass\auto-activate.exe"). Full path to the file is always the best bet. I haven't actually run the program yet, this is just what I found from glancing through. It should help, but I'm not sure if it solves everything. Wow, lots of responses before I got this one out.. and we all said the same thing. Edited March 30, 2006 by greenmachine Link to comment Share on other sites More sharing options...
Skrip Posted March 30, 2006 Author Share Posted March 30, 2006 (edited) BillMez I fixed both things you said and it worked thank you! (I'm thinking about releasing the 'pass' Programs of mine, but you people don't need to really know what they are exactly just yet!) Edited March 30, 2006 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
GaryFrost Posted March 30, 2006 Share Posted March 30, 2006 Close 'em up CODE #include-once ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.0 ; Language: English ; Description: Functions that assist with closing windows. ; ; ------------------------------------------------------------------------------ ;=============================================================================== ; ; Description: Close all windows according to $sd_method ; Syntax: _ShutDown($sd_method, $sd_leaveopen, $sd_leaveopen2, $sd_leaveopen3) ; Parameter(s): $sd_method - ===================================================== ; method 1- close all windows and log off ; method 2- close all windows and shutdown ; method 3- close all windows ; method 4- close all windows except for $sd_leaveopen ; ===================================================== ; $sd_leaveopen - "Window Title" ; $sd_leaveopen2 - "Window Title" ; $sd_leaveopen - "Window Title" ; ; Requirement(s): $sd_method ; Return Value(s): On Success - None ; On Failure - None ; Author(s): AutoItKing <bendudefu [at] aim [dot] com> ; Note(s): Use with caution! ; ;=============================================================================== Func _ShutDown($sd_method,$sd_leaveopen="Program Manager", $sd_leaveopen2="Program Manager", $sd_leaveopen3="Program Manager") $i=1 If $sd_method = 1 Then $sd_windows = WinList() While 1 If $sd_windows[$i][0] <> "" AND BitAnd( WinGetState($sd_windows[$i][1]), 2 ) AND $sd_windows[$i][0] <> "Program Manager" Then WinClose($sd_windows[$i][0]) EndIf $i = $i + 1 If $i = $sd_windows[0][0] Then Shutdown(0) ExitLoop EndIf Wend EndIf $i=1 If $sd_method = 2 Then $sd_windows = WinList() While 1 If $sd_windows[$i][0] <> "" AND BitAnd( WinGetState($sd_windows[$i][1]), 2 ) AND $sd_windows[$i][0] <> "Program Manager" Then WinClose($sd_windows[$i][0]) EndIf $i = $i + 1 If $i = $sd_windows[0][0] Then Shutdown(1) ExitLoop EndIf Wend EndIf $i=1 If $sd_method = 3 Then $sd_windows = WinList() While 1 If $sd_windows[$i][0] <> "" AND BitAnd( WinGetState($sd_windows[$i][1]), 2 ) AND $sd_windows[$i][0] <> "Program Manager" Then WinClose($sd_windows[$i][0]) EndIf $i = $i + 1 If $i = $sd_windows[0][0] Then ExitLoop EndIf Wend EndIf $i=1 If $sd_method = 4 Then $sd_windows = WinList() While 1 If $sd_windows[$i][0] <> "" AND BitAnd( WinGetState($sd_windows[$i][1]), 2 ) AND $sd_windows[$i][0] <> "Program Manager" AND $sd_windows[$i][0] <> $sd_leaveopen AND $sd_windows[$i][0] <> $sd_leaveopen2 AND $sd_windows[$i][0] <> $sd_leaveopen3 Then WinClose($sd_windows[$i][0]) EndIf $i = $i + 1 If $i = $sd_windows[0][0] Then ExitLoop EndIf Wend EndIf EndFunc ^^Please note I didn't make that code^^ Actually i'm pretty sure gafrost did. Let me look over the above posts again then i'll edit this. Round corners was me, not the rest SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Skrip Posted March 30, 2006 Author Share Posted March 30, 2006 oh right...that's what i was thinking of, btw thanks for that!READ POST #8 [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] 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