Skrip Posted July 31, 2006 Share Posted July 31, 2006 Like let's say you make a gui with an input box and a button in the middle. You type Exit in the input box, and click the button, then the au3 script exits. Or you make a msgbox, or change varibles from the box for debugging purposes. Is something like this possible. [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...
evilertoaster Posted July 31, 2006 Share Posted July 31, 2006 look into Eval() and Execute() in the BEta. There are some limitations on them though (mainly you cant delete or chagne anything) Link to comment Share on other sites More sharing options...
julmae Posted August 1, 2006 Share Posted August 1, 2006 Heres how i would propably do it 8) (didnt test it thought so it might bug a lil) : expandcollapse popupOpt("GUICloseOnESC", 1) #include <GUIConstants.au3> #include <Misc.au3> Global $Line = 0 $Title_GUI = "Test GUI" $Main_GUI = GUICreate($Title_GUI, 300, 200) $Edit_GUI = GUICtrlCreateEdit( "", 10, 0, 280, 150, $ES_READONLY) $Input_GUI = GUICtrlCreateInput("", 10, 160, 250, 20) $Button_GUI = GUICtrlCreateButton("OK", 170, 160, 20, 30) GUI_Log("GUI example", $Edit_GUI) GUI_Log("try typing /test or /exit 8)", $Edit_GUI) While 1 $Msg = GUIGetMsg() Select Case $Msg = $Button_GUI $Input = GUICtrlRead($Input_GUI) Select Case $Input = "/Test" MsgBox(0, "Test", "Msgbox executed from gui") Case $Input = "/Exit" MsgBox(0, "Test", "Example will exit now") Exit EndSelect Case _IsPressed("0D") AND WinActive($Title_GUI) $Input = GUICtrlRead($Input_GUI) If $Input <> "" Then Select Case $Input = "/Test" MsgBox(0, "Test", "Msgbox executed from gui") Case $Input = "/Exit" MsgBox(0, "Test", "Example will exit now") Exit EndSelect Case $Msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func GUI_Log($TXT, $CID) Local $Date = @MDAY & "/" & @MON & " " & @HOUR & ":" & @MIN & ":" & @SEC & " > " $Line += 1 GUICtrlSetData($CID, $Date & $TXT & @CRLF, $Line) EndFunc Link to comment Share on other sites More sharing options...
i542 Posted August 1, 2006 Share Posted August 1, 2006 There was serval ways you can do this, all depends what you want to do. If you want your 'own' piece of commands, Example A is best for you. If you want predefined AutoIt functions, look at Example B. ------------------------------------------------------------------------------------------------------- EXAMPLE A: While 1 Switch InputBox("Hello","Enter command") Case "exit" Exit Case "hi" MsgBox(64,"Commander","hi") Case "" ;here enter your command ;;;;;;; Case Else ;what if user enters unexpected command... ;;;;;;; EndSwitch Wend ;this uses betaoÝ÷ ØEÀ0òÄ«¢+Ù]¡¥±Ä(ÀÌØí½µµ¹õ%¹ÁÕÑ ½à ÅÕ½Ðí ½µµ¹ÈÅÕ½Ðì°ÅÕ½Ðí!¤¸¹ÑÈÁÉ¥¹Õѽ%нµµ¹¡É¸ÅÕ½Ðì¤)áÕÑ ÀÌØí½µµ¹¤)]¹(íÑ¡¥ÌÕÍÌѱͼ i542 I can do signature me. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted August 1, 2006 Moderators Share Posted August 1, 2006 This would be another way. #include <GuiConstants.au3> Opt("GuiOnEventMode", True) $GUI = GUICreate("Test", 200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Input = GUICtrlCreateInput("", 10, 10, 180) $Button = GUICtrlCreateButton("Execute", 10, 40, Default, Default, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent($Button, "_Execute") $Label = GUICtrlCreateLabel("Return: ", 10, 75, 180) GUISetState() While 1 Sleep(10) WEnd Func _Execute() $sCommand = GUICtrlRead($Input) $vRet = Execute($sCommand) If Not @error Then GUICtrlSetData($Label, "Return: " & $vRet) Else GUICtrlSetData($Label, "Error: " & @error) EndIf EndFunc ;==>_Execute Func _Exit() Exit EndFunc ;==>_Exit Link to comment Share on other sites More sharing options...
ptrex Posted August 1, 2006 Share Posted August 1, 2006 @Firestorm Look in my signature for DYNAMIC Functions. Have fun. Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Fossil Rock Posted August 1, 2006 Share Posted August 1, 2006 I found this to be interesting (or possibly I'm doing something wrong). Dim $LineOfCode[15] $f = @DesktopDir & "\SampleDialog.txt" $c = _FileCountLines($f) For $a = 1 To $c $LineOfCode[$a] = FileReadLine($f,$a) Execute($LineOfCode[$a]) NextoÝ÷ Ù8b±Ú²}ý· +ë"µ§!éí but this does.... SampleDialog.txt Agreement is not necessary - thinking for one's self is! 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