jlorenz1 Posted June 21, 2006 Share Posted June 21, 2006 Hi, I try to create a programm to export colors from palettes. There are three problems. First. A second window should disappear and should return to main window but without success. Second. If you have a second window, is it possible, to start this window several times like at the beginning without the undertaken changes and without spripting all these changes back? Third. This is a generally problem and it concern the behavior of the buttons. The reactions of them are very slow, if you click them. It work only reliable, if you click the buttons at the moment, if the controltips appears. I add an example script as .txt and colored .html file for showing my problems. I don't want to waste too much words, but I would be thankful in advance for any help and tipps. Johannes from Germany #include <GUIConstants.au3> ;******************** M A I N W I N D O W ************************* $MainWindow=GUICreate('Graphics',230,450) GUISetBkColor(0x2058E1) $tab=GUICtrlCreateTab (10,10, 210,410) $tab0=GUICtrlCreateTabitem ('Palette') GUICtrlSetState(-1,$GUI_SHOW) GUICtrlCreateGroup ('ArtIcons',20,40,190,90) GUICtrlCreateLabel ('Copy colors from one palette to another', 25,60,170,70) $MWBtn1=GUICtrlCreateButton ('', 175,95,32,32,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",21) GUICtrlSetTip(-1,'Export palette') GUICtrlSetFont (-1,8.5, 400, -1, 'Arial') GUICtrlCreateGroup ("Corel Drawn",20,145,190,70) GUICtrlCreateLabel ('Export palette from ArtIcon to Corel Drawn', 25,160,170,70) $MWBtn2 = GUICtrlCreateButton ('', 175,180,32,32,$BS_ICON) GUICtrlSetTip(-1,'Export palette') GUICtrlSetImage (-1, "shell32.dll",21) $SBConfig=GUICtrlCreateTabitem ( 'Configuration') GUICtrlCreateTabitem ('') ; end tabitem definition ;************* S E C O N D W I N D O W (Assistent) ***************** $Assistent1 = GUICreate('Assistent', 405, 280, -1, -1,$WS_EX_TOPMOST) GUICtrlCreateLabel('',0, 0,400,40,$SS_SUNKEN) GUICtrlSetBkColor(-1,0xFFFFFF) $otxt1=GUICtrlCreateLabel('Excercise 1',10,5, 350,20) GUICtrlSetFont (-1,10,900,1,'Arial') GUICtrlSetBkColor(-1,0xFFFFFF) $otxt2=GUICtrlCreateLabel('Describtion 1',15,20, 350,20) GUICtrlSetFont (-1,9,400,1,'Arial') GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlCreateLabel('',1,40,398,174,$SS_SUNKEN) Local $utxt=GUICtrlCreateLabel('Explaination' & @CRLF & _ @CRLF & 'Some text' & @CRLF & @CRLF & 'Source: '& @CRLF & _ @CRLF & 'Some Text.' & @CRLF & @CRLF & 'Destination: ',15, 55, 370,145) $Input1 = GUICtrlCreateInput ( '', 80, 107, 250, 20) $Input2 = GUICtrlCreateInput ( '',80, 152,250, 20) $Fort = GUICtrlCreateProgress (15,175,370,10,$PBS_SMOOTH) GUICtrlSetState(-1,$GUI_HIDE) GUICtrlCreateLabel('',1, 214,400,2,$SS_SUNKEN) $BtnBack=GUICtrlCreateButton ( 'Back', 205, 220, 60, 24,-1 ) GUICtrlSetTip ( -1, 'Back' ) GUICtrlSetState(-1,$GUI_DISABLE) $BtnCONTINUE=GUICtrlCreateButton ( 'Continue', 270, 220, 60, 24,-1 ) GUICtrlSetTip ( -1, 'Continue' ) $BtnCANCEL=GUICtrlCreateButton ( 'Cancel', 335, 220, 60, 24 ,-1) GUICtrlSetTip ( -1, 'Cancel' ) GUISwitch($MainWindow) GUISetState () ;*********************** R U N T I M E ********************* While 1 $msg = GUIGetMsg(1) Select Case $msg[0]=$MWBtn1 MsgBox(4096, "GUI Event", "You clicked MainWindow Button1" & _ @CRLF & "Call assistent for copying colors",5) GUISwitch($Assistent1) GUISetState() Case $msg[0]=$BtnBACK MsgBox(4096, "GUI Event", "You clicked AssistentWindow Button BACK",5) Case $msg[0]=$BtnCONTINUE MsgBox(4096, "GUI Event", "You clicked AssistentWindow Button CONTINUE",5) _Continue1() ;?????????????????????????? Q U E S T I O N ????????????????????????????????????????? CASE $MSG[0]=$BTNCANCEL ;THIS IS MY PROBLEM: HOW TO CLOSE ASSISTENT AND HOW RETURN TO MAINWINDOW ?????????????????? MSGBOX(4096, "GUI EVENT", "YOU CLICKED ASSISTENTWINDOW BUTTON CANCEL",5) GUISWITCH($MAINWINDOW) GUISETSTATE() ;Is there another solution than GUISETSTATE($Assistent1,$GUI_HIDE) and GUISETSTATE($Assistent1,$GUI_SHOW)? ;?????????????????????????? Q U E S T I O N ????????????????????????????????????????? Case $msg[0]= $GUI_EVENT_CLOSE And $msg[1]=$MainWindow MsgBox(4096, "GUI Event", "You clicked X and $GUI_EVENT_CLOSE of MainWindow") Exitloop Case $msg[0]= $GUI_EVENT_CLOSE And $msg[1]=$Assistent1 MsgBox(4096, "GUI Event", "You clicked AssistentWindow Button CANCEL") EndSelect Wend ;*********************** F U N C T I O NS ********************* Func _Continue1() GUICtrlSetState($BtnCONTINUE,$GUI_ENABLE) GUICtrlSetState($Input1,$GUI_HIDE) GUICtrlSetState($Input2,$GUI_HIDE) GUICtrlSetData($BtnCONTINUE,'Retry') GUICtrlSetData($BtnCANCEL,'Finish') GUICtrlSetData($otxt1,'Excercise 2') GUICtrlSetData($utxt,'Highlight the range of colors') EndFuncexampleAU3.htm Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post] Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 21, 2006 Share Posted June 21, 2006 HI, Ask for exact Problem. GERMAN: vielleicht versuchst du es mal auf deutsch, weil so verstehe ich nicht genau wo deine Probleme liegen. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
GaryFrost Posted June 21, 2006 Share Posted June 21, 2006 might want to change the label(s) height to begin with so they don't interfer with the buttons 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...
jlorenz1 Posted June 21, 2006 Author Share Posted June 21, 2006 Hi, Okay in German: Wenn Du im Skript ist genau die Stelle markiert, an der das 2.Fenster mit dem Titel Assistent wieder geschlossen und das Hauptfenster wieder aktiviert werden soll. GUISWITCH funktioniert, wenn ich weg vom Hauptfenster das zweite Fernster öffne. Aber ich kann den Weg nicht umgekehrt machen. Also schliesse 2.Fenster öffne Hauptfenster. Daneben stellte ich die Frage, ob ein zweiter Fenster auf den Stand der Iniatilisierung wieder zurückgedreht werden ohne daß man jede inzwischen erfolgte Veränderung herausskripten muss. Schließlich fällt mir auf daß das Ansteuern der Schaltflächen sehr schwerfällig ist und das Anklicken einer Schaltfläche nur dann funktioniert, wenn das Quickinfo sichtbar ist. Das aber nur am Rande. Größtes Problem ist wieder zurück zum Hauptfenster zu kommen. GUISWITCH sollte doch auch umgekehrt funktionieren. Herzlichst Johannes :"> Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post] Link to comment Share on other sites More sharing options...
jlorenz1 Posted June 21, 2006 Author Share Posted June 21, 2006 So I will try once again. I highlight the problem in my script. It is possible me to switch from main window to secondary window with the title 'assistent'. After some work I want to close the secondary window and want retuirn back to the main window. First step works with the command GUISWITCH but not the way back (away from secondary window to main window) It must work although with GUISWITCH, doesn't it? This is the main question. Thanks in advance Johannes :"> Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post] Link to comment Share on other sites More sharing options...
jpm Posted June 23, 2006 Share Posted June 23, 2006 I cannot understand German answer, but I warn you that GUISwitch as nothing to do with WinActivate. I mean that thte GUISwith is only needed to change the default windows the GUI work with. Sometime you can see it is doing some activation but that's not the main intention of this function. Please reread the doc. Thanks Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 23, 2006 Share Posted June 23, 2006 (edited) So I will try once again. I highlight the problem in my script. It is possible me to switch from main window to secondary window with the title 'assistent'. After some work I want to close the secondary window and want retuirn back to the main window. First step works with the command GUISWITCH but not the way back (away from secondary window to main window) It must work although with GUISWITCH, doesn't it? This is the main question. Thanks in advance Johannes :"> The default action of GuiSetState() is @SW_SHOW, not to activate, so unless the GUI was hidden it makes no difference. Try: ;?????????????????????????? Q U E S T I O N ????????????????????????????????????????? CASE $MSG[0]=$BTNCANCEL MSGBOX(4096, "GUI EVENT", "YOU CLICKED ASSISTENTWINDOW BUTTON CANCEL",5) WinActivate("Your Main GUI Title") P.S. If you were doing this in a function that doesn't know the title of the GUI you could: ;?????????????????????????? Q U E S T I O N ????????????????????????????????????????? CASE $MSG[0]=$BTNCANCEL MSGBOX(4096, "GUI EVENT", "YOU CLICKED ASSISTENTWINDOW BUTTON CANCEL",5) Opt("WinTitleMatchMode", 4) WinActivate($MAINWINDOW) Edited June 23, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Uten Posted June 23, 2006 Share Posted June 23, 2006 I'm not shure if you are talking about AutoIt windows, but if you are, this might be a solution? expandcollapse popuptestWindowSwitch() Exit ; =========================================== Func testWindowSwitch() $guiOne = GuiOne(@SW_SHOW) MsgLoopOne($guiOne) Endfunc Func GuiOne($state) Local $ret= GUICreate("GUI ONE", 100, 100, 100, 100) GUISetState($state) Return $ret EndFunc Func GuiTwo($state) Local $ret= GUICreate("GUI TWO", 200, 200, 50, 50) GUISetState($state) Return $ret EndFunc Func MsgLoopOne($gui) Local $ret = 0 While NOT $ret $msg = GUIGetMsg() Switch $msg Case 0 Sleep (200) case -3;$GUI_EVENT_CLOSE $ret = 1;ExitLoop Case -7;$GUI_EVENT_PRIMARYDOWN GUISetState(@SW_HIDE, $gui) $guiTwo = GuiTwo(@SW_SHOW) MsgLooptTwo($guiTwo) GUISetState(@SW_SHOW, $gui) Case Else ;;; EndSwitch Wend EndFunc Func MsgLooptTwo($gui) Local $ret = 0 While NOT $ret $msg = GUIGetMsg() Switch $msg Case 0 Sleep (200) case -3, -7;$GUI_EVENT_CLOSE , $GUI_EVENT_PRIMARYDOWN GUIDelete($gui) $ret = 1;ExitLoop Case Else ;;; EndSwitch WEnd EndFunc Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling 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