Skrip Posted February 3, 2009 Posted February 3, 2009 Is it possible to read and write vars of one script with another script? I've seen the debugger, but I don't know if that'll suit the purpose. [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]
bundyxc Posted February 3, 2009 Posted February 3, 2009 Is it possible to read and write vars of one script with another script? I've seen the debugger, but I don't know if that'll suit the purpose.Well, you could write your vars to an INI. Would that work? Global $arr[2] $arr[0]="hip" $arr[1]="hip" ;^^ hip hip array. ^^
Skrip Posted February 3, 2009 Author Posted February 3, 2009 Well, you could write your vars to an INI. Would that work?That could work. I was going to have them write to another window, then have the other script read and write to those. But I was wondering if there was a more direct way to do it. [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]
bundyxc Posted February 3, 2009 Posted February 3, 2009 I can't think of any, but I'm an AutoIt noob. I'm thinking that you just write to an INI (or a plaintext file), and have your other one read it. How are they going to know how to communicate with eachother? Are they both being run at the same time? Global $arr[2] $arr[0]="hip" $arr[1]="hip" ;^^ hip hip array. ^^
MrCreatoR Posted February 3, 2009 Posted February 3, 2009 (edited) You can do it only with predefined interaction handeling, like this for example:Sender.au3#include <GuiConstantsEx.au3> $GUI = GUICreate("Sender Script", 200, 140) $SetVar_Button = GUICtrlCreateButton("SET Variable", 40, 20, 120, 20) $SetValue_Input = GUICtrlCreateInput("Assign('i_Var', 1)", 40, 40, 120, 20) $GetVar_Button = GUICtrlCreateButton("GET Variable", 40, 80, 120, 20) $GetValue_Input = GUICtrlCreateInput("Eval('i_Var')", 40, 100, 120, 20) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $SetVar_Button $sSend_Data = "SET_VAR" & @CRLF & GUICtrlRead($SetValue_Input) ControlSetText("[CLASS:AutoIt v3;TITLE:Reciever Script]", "", "Edit1", $sSend_Data) Case $GetVar_Button $sSend_Data = "GET_VAR" & @CRLF & GUICtrlRead($GetValue_Input) ControlSetText("[CLASS:AutoIt v3;TITLE:Reciever Script]", "", "Edit1", $sSend_Data) Sleep(10) $sRet_Data = ControlGetText("[CLASS:AutoIt v3;TITLE:Reciever Script]", "", "Edit1") ControlSetText("[CLASS:AutoIt v3;TITLE:Reciever Script]", "", "Edit1", "") GUICtrlSetData($GetValue_Input, $sRet_Data) EndSwitch WEndReciever:expandcollapse popup#include <GuiConstantsEx.au3> AutoItWinSetTitle("Reciever Script") Global $i_Var = 0 $GUI = GUICreate("Reciever Script", 300, 200) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $sInteract_Data = ControlGetText("[CLASS:AutoIt v3;TITLE:Reciever Script]", "", "Edit1") If $sInteract_Data <> "" Then ControlSetText("[CLASS:AutoIt v3;TITLE:Reciever Script]", "", "Edit1", "") $sFirst_Line = StringLeft($sInteract_Data, StringInStr($sInteract_Data, @CRLF)) $sFirst_Line = StringStripWS($sFirst_Line, 3) $sMsg = StringTrimLeft($sInteract_Data, StringInStr($sInteract_Data, @CRLF)) $sMsg = StringStripWS($sMsg, 3) Switch $sFirst_Line Case "GET_VAR" $sGet_Var = Execute($sMsg) If $sGet_Var = "" Then $sGet_Var = Eval($sMsg) ConsoleWrite($sGet_Var & @CRLF) ControlSetText("[CLASS:AutoIt v3;TITLE:Reciever Script]", "", "Edit1", $sGet_Var) While ControlGetText("[CLASS:AutoIt v3;TITLE:Reciever Script]", "", "Edit1") <> "" Sleep(10) WEnd Case "SET_VAR" Execute($sMsg) MsgBox(64, $sFirst_Line, "$i_Var = " & $i_Var, 0, $GUI) EndSwitch EndIf WEnd Edited July 7, 2009 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Skrip Posted February 3, 2009 Author Posted February 3, 2009 Oh I see. That's simple enough. Thanks. [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]
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