PsaltyDS Posted April 13, 2007 Posted April 13, 2007 Somebody asked about way to have two .exe compiled scripts pass data between each other. One method discussed was simply reading the contents of each other's GUI controls. These two scripts were to demonstrate that. The first script presents a gui that takes and expression like "1 + 2" and returns the cube ("27"), only there is no code in the script to do the math:expandcollapse popup#include <guiconstants.au3> ; Create GUI Opt("GuiOnEventMode", 1) $hGUI = GUICreate("Parent GUI", 270, 170, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") GUICtrlCreateLabel("Input number to be cubed (X) and click OK:", 10, 10, 250, 30) GUICtrlCreateLabel("X = ", 10, 55, 150, 30) $Edit1 = GUICtrlCreateInput(" ", 70, 50, 150, 30) GUICtrlCreateLabel("X^3 = ", 10, 95, 150, 30) $Edit2 = GUICtrlCreateInput(" ", 70, 90, 150, 30) $Button1 = GUICtrlCreateButton("OK", 100, 130, 50, 30) GUICtrlSetOnEvent($Button1, "_OK") GUICtrlSetState($Edit1, $GUI_FOCUS) GUISetState() While 1 Sleep(20) WEnd Func _OK() GUICtrlSetData($Edit1, Number(Execute(GUICtrlRead($Edit1)))) GUICtrlSetData($Edit2, "...processing") GUICtrlSetState($Edit1, $GUI_FOCUS) EndFunc ;==>_OK Func _Quit() Exit EndFunc ;==>_QuitoÝ÷ Ù8^«aÆr©+!yÖòjÇ©j¶z趦r©W~º&¶¬r¸©µ·¥£!Èky§ljwp®+^²Ú-ç(Úèȧ¶¬r¸©µ¦è½ã§zíê-êæºË[yÊ&¦)^u©Ý®éß®ç±zȧqä10¢}ý¶»§najÛazƦzئ{^AºØv¬m«mz¼!Èb±Ê&¦)^vÛ¢Øh¯br¬²Ö«µç_»-jëh×6#include <guiconstants.au3> ; Wait for parent WinWait("Parent GUI") WinActivate("Parent GUI") WinWaitActive("Parent GUI") ; Create GUI $hGUI = GUICreate("Child GUI", 200, 130, 470, 100) $Label1 = GUICtrlCreateLabel("Input = <none>", 10, 10, 180, 30, $SS_CENTER) $Label2 = GUICtrlCreateLabel("Output = <none>", 10, 50, 180, 30, $SS_CENTER) $Label3 = GUICtrlCreateLabel("Cubes done = 0", 10, 90, 180, 30, $SS_CENTER) GUISetState() $CubeCnt = 0 While 1 $Flag = ControlGetText("Parent GUI", "", "Edit2") If @error Then MsgBox(16, "Child GUI", "Parent GUI, Input2 control not found... exiting.", 10) Exit Else If $Flag = "...processing" Then $Input = Number(ControlGetText("Parent GUI", "", "Edit1")) GUICtrlSetData($Label1, "Input = " & $Input) $Output = $Input ^ 3 GUICtrlSetData($Label2, "Output = " & $Output) $CubeCnt += 1 GUICtrlSetData($Label3, "Cubes done = " & $CubeCnt) ControlSetText("Parent GUI", "", "Edit2", $Output) EndIf EndIf Sleep(100) WEnd Func _Quit() Exit EndFunc ;==>_Quit 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
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