i'm working on a script with someone at work. now he gave me his part. i put our both parts together. but now i have a little problem.
the main window shows and hides with mouse movement. at this mainwindow is a button "Hinzufügen".
if you click it, a second window pops up. while this second window is opened, the mainwindow is hidden. as soon you re done with the second window, it closes and the mainwindow should show up again, but it dont
i've tried at least for 3 hours now. could you please help me?
here the source
AutoIt
#include <Array.au3> #include <WindowsConstants.au3> #include <Inet.au3> #include <GUIConstantsEx.au3> $b = True If $b = True Then FileInstall("////////", "///////////", 1) ;i had to remove HotKeySet("{ESC}", "_Exit") ; Set the Hotkey to exit. $hDLL = DllOpen("user32.dll") ; Open the DLL for _WinIsHovered() (faster with DLL-handle) $h_Top= GUICreate("////////////", 500, 180, -1, -1, -1, $WS_EX_TOPMOST) ;i had to remove ; $_Button1 = GUICtrlCreateButton("////////", position rechts-links , hoch-runter, 100, 30) $_Button1 = GUICtrlCreateButton("", 10, 20, 100, 30) $_Button2 = GUICtrlCreateButton("Hinzufügen", 10, 60, 100, 30) $_Button3 = GUICtrlCreateButton("Funk2", 10, 100, 100, 30) $_Button4 = GUICtrlCreateButton("Funk3", 10, 140, 100, 30) $_Button5 = GUICtrlCreateButton("", 120, 20, 100, 30) $_Button6 = GUICtrlCreateButton("Funk4", 120, 60, 100, 30) $_Button7 = GUICtrlCreateButton("Funk5", 120, 100, 100, 30) $_Button8 = GUICtrlCreateButton("Funk6", 120, 140, 100, 30) $_Button9 = GUICtrlCreateButton("Support", 230, 140, 100, 30) GUICtrlCreatePic ("//////////", 375, 20, 110, 110) ;i had to remove GUICtrlCreateLabel ("/////////", 367, 150) ;Main Window $mainWin = GUICreate("Neuer Account",190,150) GUICtrlCreateGroup("Auswahl",20,10,150,95) GUIStartGroup() $rb1 = GUICtrlCreateRadio("Station",40,25) $rb2 = GUICtrlCreateRadio("Agent",40,50) $rb3 = GUICtrlCreateRadio("Search and Replay",40,75) $rb4 = GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group $btn = GUICtrlCreateButton("Weiter",80,115) ;Window 1 $win1 = GUICreate("Station Hinzufügen",190,150) GUICtrlCreateLabel("Extension",5,28) $ein1 = GUICtrlCreateInput("",60,25,110) GUICtrlCreateLabel("SU",5,53) $dbox = GUICtrlCreateCombo("",60,50,110) GUICtrlCreateLabel("Passwort",5,78) $ein2 = GUICtrlCreateInput("",60,75,110) $btn1 = GUICtrlCreateButton("Zurück",40,115,50) $btn2 = GUICtrlCreateButton("Weiter",100,115,50) ;Window 2 $win2 = GUICreate("A",190,175) GUICtrlCreateLabel("Vorname",5,28) $ein2 = GUICtrlCreateInput("",60,25,110) GUICtrlCreateLabel("Nachname",5,53) $ein3 = GUICtrlCreateInput("",60,50,110) GUICtrlCreateLabel("Mail",5,78) $ein4 = GUICtrlCreateInput("",60,75,110) GUICtrlCreateLabel("Gruppe",5,103) $ein5 = GUICtrlCreateInput("",60,100,110) $btn3 = GUICtrlCreateButton("Zurück",40,140,50) $btn4 = GUICtrlCreateButton("Weiter",100,140,50) ;Window 3 $win3 = GUICreate("SeuR",190,175) GUICtrlCreateLabel("User ID",5,28) $ein6 = GUICtrlCreateInput("",60,25,110) GUICtrlCreateLabel("Vorname",5,53) $ein7 = GUICtrlCreateInput("",60,50,110) GUICtrlCreateLabel("Nachname",5,78) $ein8 = GUICtrlCreateInput("",60,75,110) GUICtrlCreateLabel("Gruppe",5,103) $ein9 = GUICtrlCreateInput("",60,100,110) $btn5 = GUICtrlCreateButton("Zurück",40,140,50) $btn6 = GUICtrlCreateButton("Weiter",100,140,50) ;Final Window $finwin = GUICreate("",130,90) GUICtrlCreateLabel("Weiter?",5,18) $btny = GUICtrlCreateButton("Nein",60,40,50) $btnx = GUICtrlCreateButton("Ja",5,40,50) ; Move GUI's to the right place and set the Variables State to False Global $Top_IN = False _SlideWin($h_Top, "out", "top") ; Show GUI's GUISetState(@SW_SHOWNOACTIVATE, $h_Top) While 1 * Sleep(10) $nMsg = GUIGetMsg(1) Select Case $nMsg[0] = -3 _Exit() Case $nMsg[0] = $_Button1 Run("////////////////////////", "", @SW_MAXIMIZE) ; i had to remove Case $nMsg[0] = $_Button2 _NewAcc() Case $nMsg[0] = $_Button3 MsgBox(0, "", "to be defined") Case $nMsg[0] = $_Button4 MsgBox(0, "", "to be defined") Case $nMsg[0] = $_Button5 Run("c:program filesmozilla firefoxfirefox.exe <a href='http://cssweb01.de.ibm.com/cks-soko' class='bbc_url' title='External link' rel='nofollow external'>http://cssweb01.de.ibm.com/cks-soko"</a>, "", @SW_MAXIMIZE) Sleep (1200) if ProcessExists("firefox.exe") = 0 Then run ("c:program files (x86)mozilla firefoxfirefox.exe <a href='http://cssweb01.de.ibm.com/cks-soko' class='bbc_url' title='External link' rel='nofollow external'>http://cssweb01.de.ibm.com/cks-soko"</a>, "", @SW_MAXIMIZE) EndIf Sleep (1200) if ProcessExists("firefox.exe") = 0 Then MsgBox(0, "", "Firefox konnte nicht gestartet werden!") EndIf Case $nMsg[0] = $_Button6 MsgBox(0, "", "to be defined") Case $nMsg[0] = $_Button7 MsgBox(0, "", "to be defined") Case $nMsg[0] = $_Button8 MsgBox(0, "", "to be defined") Case $nMsg[0] = $_Button9 Local $Body = InputBox('Body', 'Enter the body (message) of the E-Mail') MsgBox(0, 'Supportanfrage', 'E-Mail wurde erstellt! ID ' & _INetMail("lars.heydrich@de.ibm.com", "Supportanfrage DB SOKO Tool", $Body)) Case _WinIsHovered($h_Top, $hDLL) If Not $TOP_IN Then _SlideWin($h_Top, "in", "top") $TOP_IN = True EndIf Case Else ; No window is hovered. Check if we need to Slide out a GUI. Select Case $TOP_IN _SlideWin($h_Top, "out", "top") $TOP_IN = False EndSelect EndSelect WEnd Func _SlideWin($hWnd, $sMode, $sSide) ;$hWnd = Window to slide. ;$sMode = Slide-In or -out (in|out) ;$sSide = Side where you want the GUI to slide. (left|right|top|bottom) Local $aScreen_Res = WinGetPos(WinGetHandle("Program Manager")) Local $aWPos = WinGetPos($hWnd), $m = 0 - ($sMode = "in") + ($sMode = "out") Local $h = 0 - ($sSide = "left") + ($sSide = "right"), $v = 0 - ($sSide = "top") + ($sSide = "bottom") WinMove($hWnd, "", _ ; Move GUI according to $sMode and $sSide. $aScreen_Res[0] - (($h = -1) * ($m = -1) * ($aWPos[2] - 10)) _ + (($h = 1) * (($h = 1) * $aScreen_Res[2] - (10 * ($m = -1)) - ($m <> -1) * $aWPos[2])) _ + (($h = 0) * (($h = 0) * ($aScreen_Res[2] / 2) - ($aWPos[2] / 2))) _ , _ $aScreen_Res[1] - (($v = -1) * ($m = -1) * ($aWPos[3] - 10)) _ + (($v = 1) * (($v = 1) * $aScreen_Res[3] - (10 * ($m = -1)) - ($m <> -1) * $aWPos[3])) _ + (($v = 0) * (($v = 0) * ($aScreen_Res[3] / 2) - ($aWPos[3] / 2))) _ ) $aWPos = WinGetPos($hWnd) ; Slide GUI. Switch $sSide Case "left", "right" Local $STEP = (((($h = 1) And ($m = 1)) Or (($h = -1) And ($m = -1))) - ((($h = -1) And ($m = 1)) Or (($h = 1) And ($m = -1)))) * 10 Local $FROM = $aWPos[0], $TO = $aWPos[0] _ + (((($h = 1) And ($m = 1)) Or (($h = -1) And ($m = -1))) * ($aWPos[2])) _ - (((($h = 1) And ($m = -1)) Or (($h = -1) And ($m = 1))) * ($aWPos[2])) - $STEP For $i = $aWPos[0] To $TO Step $STEP WinMove($hWnd, "", $i, $aWPos[1]) Sleep(10) Next Case "top", "bottom" Local $STEP = (((($v = 1) And ($m = 1)) Or (($v = -1) And ($m = -1))) - ((($v = -1) And ($m = 1)) Or (($v = 1) And ($m = -1)))) * 10 Local $FROM = $aWPos[1], $TO = $aWPos[1] _ + (((($v = 1) And ($m = 1)) Or (($v = -1) And ($m = -1))) * ($aWPos[3])) _ - (((($v = 1) And ($m = -1)) Or (($v = -1) And ($m = 1))) * ($aWPos[3])) - $STEP For $i = $aWPos[1] To $TO Step $STEP WinMove($hWnd, "", $aWPos[0], $i) Sleep(10) Next EndSwitch EndFunc ;==>_SlideWin Func _WinIsHovered($hWnd, $vDLL = "User32.dll") Local $aResult, $aWPos = WinGetPos($hWnd), $aMPos = MouseGetPos() Local $tRect = DllStructCreate("int Left;int Top;int Right;int Bottom") Local $iLeft = $aWPos[0], $iTop = $aWPos[1], $iWidth = $aWPos[2], $iHeight = $aWPos[3] Local $iX = $aMPos[0], $iY = $aMPos[1] DllStructSetData($tRect, "Left", $iLeft) DllStructSetData($tRect, "Top", $iTop) DllStructSetData($tRect, "Right", $iLeft + $iWidth) DllStructSetData($tRect, "Bottom", $iTop + $iHeight) $aResult = DllCall($vDLL, "int", "PtInRect", "ptr", DllStructGetPtr($tRect), "int", $iX, "int", $iY) If @error Then Return SetError(@error, 0, False) Return $aResult[0] <> 0 EndFunc ;==>_WinIsHovered Func _NewAcc() _SlideWin($h_Top, "out", "top") GUISetState(@SW_Show,$mainWin) While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $mainWin Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $btn If GUICtrlRead($rb1) = 1 Then GUISetState(@SW_HIDE, $mainWin) GUISetState(@SW_SHOW, $win1) ElseIf GUICtrlRead($rb2) = 1 Then GUISetState(@SW_HIDE, $mainWin) GUISetState(@SW_SHOW, $win2) ElseIf GUICtrlRead($rb3) = 1 Then GUISetState(@SW_HIDE, $mainWin) GUISetState(@SW_SHOW, $win3) EndIf EndSwitch Case $win1 Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $btn1 GUISetState(@SW_Show,$mainWin) GUISetState(@SW_HIDE,$win1) Case $btn2 GUISetState(@SW_SHOW,$finwin) GUISetState(@SW_HIDE,$win1) EndSwitch Case $win2 Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $btn3 GUISetState(@SW_Show,$mainWin) GUISetState(@SW_HIDE,$win2) Case $btn4 GUISetState(@SW_SHOW,$finwin) GUISetState(@SW_HIDE,$win2) EndSwitch Case $win3 Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $btn5 GUISetState(@SW_Show,$mainWin) GUISetState(@SW_HIDE,$win3) Case $btn6 GUISetState(@SW_SHOW,$finwin) GUISetState(@SW_HIDE,$win3) EndSwitch Case $finwin Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $btnx GUISetState(@SW_Show,$mainWin) GUISetState(@SW_HIDE,$finwin) Case $btny GUISetState(@SW_HIDE,$finwin) _WinIsHovered($h_Top, $hDLL) EndSwitch EndSwitch WEnd EndFunc Func _Exit() DllClose($hDLL) ; Dont forget to close your DLL-Handle Exit EndFunc ;==>_Exit
Edited by airrs, 29 August 2012 - 12:18 PM.



