WeMartiansAreFriendly Posted August 21, 2008 Posted August 21, 2008 (edited) Here's a bumped and reformatted ANYGUI UDF for the latest AutoIt version. I hope quaizywabbit will come back some day and continue his awesome work. ----------------Unofficial Updates----------------------- **21 AUG 2008 updated to support AutoIt 3.2.12.x with the following changes.. - Errors are debugged to console instead of a msgbox() - Reformated for consistency with the new UDF scheme (Older scripts will need to be updated) Older ........................... Newer ---------------------------------------------------------- ; _GuiTarget --> _AnyGUI_Create ; _EndTarget --> _AnyGUI_Destroy ; _TargetaddChild( --> _AnyGUI_AddChild ; _TargetaddAvi --> _AnyGUI_AddAvi ; _TargetaddButton --> _AnyGUI_AddButton ; _TargetaddCheckbox --> _AnyGUI_AddCheckbox ; _TargetaddCombo --> _AnyGUI_AddCombo ; _TargetaddDate --> _AnyGUI_AddDate ; _TargetaddEdit --> _AnyGUI_AddEdit ; _TargetaddGraphic --> _AnyGUI_AddGraphic ; _TargetaddGroup --> _AnyGUI_AddGroup ; _TargetaddIcon --> _AnyGUI_AddIcon ; _TargetaddInput --> _AnyGUI_AddInput ; _TargetaddLabel --> _AnyGUI_AddLabel ; _TargetaddList --> _AnyGUI_AddList ; _TargetaddDragList --> _AnyGUI_AddDragList ; _TargetaddListview --> _AnyGUI_AddListview ; _TargetaddMonthCal --> _AnyGUI_AddMonthCal ; _TargetaddObj --> _AnyGUI_AddObj ; _TargetaddPic --> _AnyGUI_AddPic ; _TargetaddProgress --> _AnyGUI_AddProgress ; _TargetaddSlider --> _AnyGUI_AddSlider ; _TargetaddTab --> _AnyGUI_AddTab ; _TargetaddTreeview --> _AnyGUI_AddTreeview ; _TargetStyle --> _AnyGUI_SetStyle ; _WinMenuGetHandle --> _AnyGUI_GetMenuHandle ; _WinMenuSetState --> _AnyGUI_SetMenuState Oh and can't forget here is an example ;embeds controls into calc.exe #include "ANYGUIv2.8a.au3" Opt ("WinTitleMatchMode", 4) Local $sClass = '[CLASS:SciCalc]' Local $nPID = Run ("calc.exe") WinWait ( $sClass ) $Pos = WinGetPos ( $sClass ) WinMove ( $sClass, '', (@DesktopWidth-$Pos[2])/2, (@DesktopHeight-$Pos[3])/2, $Pos[2] + 47, $Pos[3] ) _AnyGUI_Create( $sClass, 1 ) $Quit = _AnyGUI_AddButton ( "Quit", $Pos[2]-10, 37, 50, 29 ) $Quit = $Quit[0] GUISetState ( ) _AnyGUI_AddLabel ( "Notepad", $Pos[2]-10, 66, 50, 18 ) GUISetState ( ) _AnyGUI_AddEdit ( "", $Pos[2]-10, 84, 50, 115 ) GUISetState ( ) While 1 $msg = GUIGetMsg ( ) If $msg = $Quit Then Exit If Not WinExists ( $sClass ) Then Exit WEnd Func OnAutoItExit() ProcessClose ( $nPID ) EndFuncANYGUIv2.8a.au3 Edited August 22, 2008 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Draygoes Posted August 22, 2008 Posted August 22, 2008 I would like to request a function... Add a menu item to the title bar menu... Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.
gseller Posted August 22, 2008 Posted August 22, 2008 I agree, I hope quaizywabbit will continue development on this.. Thanks for the update!
Malkey Posted August 22, 2008 Posted August 22, 2008 Playing around with SciCalc example. I can report that it is possible to read and write to the existing Edit control. I added a GCD button (Greatest Common Denominator). This needed two input boxes for the two numbers to be entered. The result appears in the existing edit control. I was getting some unbelievable results from the GCD routine. The Fac (Factors) button was added as a check. Both added buttons output to the added edit control. So this is just another example - expandcollapse popup;embeds controls into calc.exe #include "ANYGUIv2.8a.au3" Opt("WinTitleMatchMode", 4) Global Const $ES_RIGHT = 2 Global Const $ES_AUTOHSCROLL = 128 Local $sClass = '[CLASS:SciCalc]' Local $nPID = Run("calc.exe") Local $iDat1, $iDat2 WinWait($sClass) $Pos = WinGetPos($sClass) WinMove($sClass, '', (@DesktopWidth - $Pos[2]) / 2, (@DesktopHeight - $Pos[3]) / 2, $Pos[2] + 150, $Pos[3]) _AnyGUI_Create($sClass, 1) $input1 = _AnyGUI_AddInput("0", $Pos[2] - 12, 2, 73, 22, BitOR($ES_RIGHT, $ES_AUTOHSCROLL)) $input1 = $input1[0] GUISetState() $input2 = _AnyGUI_AddInput("0", $Pos[2] + 64, 2, 73, 22, BitOR($ES_RIGHT, $ES_AUTOHSCROLL)) $input2 = $input2[0] GUISetState() $Clr = _AnyGUI_AddButton("Clr", $Pos[2] - 12, 62, 36, 29) $Clr = $Clr[0] GUISetState() $Quit = _AnyGUI_AddButton("Quit", $Pos[2] + 27, 62, 36, 29) $Quit = $Quit[0] GUISetState() $GCD = _AnyGUI_AddButton("GCD", $Pos[2] - 12, 98, 36, 29) ;$Pos[2]-12, 62, 36, 29 ) $GCD = $GCD[0] GUISetState() $Fac = _AnyGUI_AddButton("Fac", $Pos[2] + 27, 98, 36, 29) ;$Pos[2]-12, 62, 36, 29 ) $Fac = $Fac[0] GUISetState() _AnyGUI_AddLabel("Notepad", $Pos[2] - 12, 130, 50, 18) GUISetState() $Edit = _AnyGUI_AddEdit("", $Pos[2] - 12, 148, 150, 110) $Edit = $Edit[0] GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $input1 $iDat1 = GUICtrlRead($input1) Case $input2 $iDat2 = GUICtrlRead($input2) Case $Clr GUICtrlSetData($Edit, "") GUICtrlSetData($input1, "0") GUICtrlSetData($input2, "0") $iDat1 = 0 $iDat2 = 0 Case $GCD If $iDat1 > 0 And $iDat2 > 0 Then $iGCD = gcd($iDat1, $iDat2) ClipPut($iGCD) ControlFocus("Calculator", "", "[X:8\; Y:2\]") Send("^v") GUICtrlSetData($Edit, "The GCD of " & $iDat1 & " and " & $iDat2 & " is " & $iGCD & @CRLF, $Edit) EndIf Case $Fac $InputCalc = Number(ControlGetText("Calculator", "", "[X:8\; Y:2\]")) $PrimMes = "" If Abs($InputCalc) > 0 Then $PrimMes &= "Factors of " & $InputCalc & " is " & Prim($InputCalc) & @CRLF If Abs($iDat1) > 0 Then $PrimMes &= "Factors of " & $iDat1 & " is " & Prim($iDat1) & @CRLF If Abs($iDat2) > 0 Then $PrimMes &= "Factors of " & $iDat2 & " is " & Prim($iDat2) & @CRLF GUICtrlSetData($Edit, $PrimMes, $Edit) Case $GUI_EVENT_CLOSE Or $Quit Or Not WinExists($sClass) Exit EndSwitch WEnd Func OnAutoItExit() ProcessClose($nPID) EndFunc ;==>OnAutoItExit ;Greatest Common Denominator - Euclid's algorithm. Func gcd($a, $m) Dim $p = 0, $r = 0 $p = Mod($a, $m) If $p = 0 Then $a = $r Else $r = $m Do $b = Mod($r, $p) $r = $p $p = $b Until $b = 0 EndIf Return $r EndFunc ;==>gcd ; Given a Number $a returns the factors of that number Func Prim($a) $factors = "" Dim $b, $c If $a > 0 Then If $a <> 0 Then $a = Int($a) While $a / 2 - Int($a / 2) = 0 $a = $a / 2 $factors = $factors & "2 " WEnd $b = 3 $c = ($a) * ($a) + 1 Do If $a / $b - Int($a / $B) = 0 Then If $a / $b * $b - $a = 0 Then $factors = $factors & $b & " " $a = $a / $b EndIf EndIf If $a / $b - Int($a / $B) <> 0 Then $b = $b + 2 $c = ($a) * ($a) + 1 Until $b > $c Or $b = $c If $a <> 1 Then $factors = $factors & $a & " " EndIf EndIf Return $factors EndFunc ;==>Prim of how to waste time.
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