andrewfam Posted July 7, 2009 Share Posted July 7, 2009 Hi all, I have two autoit files. One is Main.exe, it has GUIs on it. Other is Secondary.exe, it is just a script and doesn't have any GUI. I run these files simultaneously. They both use while loops in their scripts. I start with the Main.exe and use Run command to execute Secondary.exe. My question is: Can I get a value of one of the controls from Main.exe and pass it to Secondary.exe? Thanks Andrew Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 7, 2009 Share Posted July 7, 2009 Yes. The ControlGetText function works on AutoIt GUIs too. Link to comment Share on other sites More sharing options...
andrewfam Posted July 7, 2009 Author Share Posted July 7, 2009 Thanks for the fast reply, Richard. Does this function work with slider control? I used Autoit v3 Window Info Tool and it gave me this information: >>>> Window <<<< Title: Main Class: AutoIt v3 GUI Position: 847, 121 Size: 397, 569 Style: 0x94CA0000 ExStyle: 0x00000108 Handle: 0x00320458 >>>> Control <<<< Class: msctls_trackbar32 Instance: 9 ClassnameNN: msctls_trackbar329 Advanced (Class): [CLASS:msctls_trackbar32; INSTANCE:9] ID: 45 Text: Position: 113, 304 Size: 249, 25 ControlClick Coords: 117, 10 Style: 0x50000001 ExStyle: 0x00000000 Handle: 0x001204AA How can I use ControlGetText function to read the position of the slider? Thanks Andrew Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 7, 2009 Share Posted July 7, 2009 No, that function is for text. For your slider control, use the GuiSlider UDFs. It's part of the AutoIt install. Link to comment Share on other sites More sharing options...
andrewfam Posted July 8, 2009 Author Share Posted July 8, 2009 Thanks for pointing me to the right direction. I got the information from the help file: #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiSlider.au3> Opt('MustDeclareVars', 1) $Debug_S = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hSlider ; Create GUI GUICreate("Slider Get Pos", 400, 296) $hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE)) GUISetState() ; Set Pos _GUICtrlSlider_SetPos($hSlider, Random(0, 100, 1)) ; Get Pos MsgBox(4160, "Information", "Pos: " & _GUICtrlSlider_GetPos($hSlider)) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main I can see it shows the value within this script, but I don't know how to pass this handle to another script. Thanks Andrew Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 8, 2009 Share Posted July 8, 2009 I figured you'd have the second script read it. Can you not do that? Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 8, 2009 Share Posted July 8, 2009 I can see it shows the value within this script, but I don't know how to pass this handle to another script.No need to pass it, the second script can get the control handle with ControlGetHandle() the same way you would with a third-party app. 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...
andrewfam Posted July 8, 2009 Author Share Posted July 8, 2009 Finally I got it. On the second script I used ControlGetHandle() like PsaltyDs suggested. $handle = ControlGetHandle("Slider Get Pos", "", 3) And then I used _GUICtrlSlider_GetPos() like Richard advised. MsgBox(4096, "Test", "Pos: " & _GUICtrlSlider_GetPos($handle) , 10) Thank you, Richard & PsaltyDS. 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