ppat Posted February 26, 2009 Posted February 26, 2009 Is there a way to access a GUI created by a different script? For example, script C:\A.au3 creates a GUI GuiCreate("Countdown", 400, 89) GUISetState(@SW_SHOW) RunWait("""" & "C:\Program Files\AutoIt3\AutoIt3.exe" & """ """& "C:\B.au3" & """ ") MsgBox(0,"The end", "The end") which I want to modify in Script B.au3: $result = GUICtrlCreateLabel("Dynamically added label", 5, 10) What I want is that Script B.au3 dynamically adds a label to the GUI created in script a.au3. Obviously, this fails and $result is 0. How can I specify in Script B.au3 that the GUI to add the label to is the one created in A.au3? Is the GUI concept linked to a single script?
unixu Posted February 26, 2009 Posted February 26, 2009 for that you have to include B.au3 in to a.au3 and call it after a specific functio or variable is set or called. you cant modify already launched guis from outside.
ppat Posted February 26, 2009 Author Posted February 26, 2009 B.au3 is a totally independent script. It is on a separate encrypted drive with a different letter. I should have put that in the 1st post, the path is G:\B.au3 (instead of C:\B.au3). B.au3and contains passwords, so I cannot put it inside C:\Program Files\AutoIt3\Include. That is why I use the RunWait line. Is there a way to include B.au3 without putting it in C:\Program Files\AutoIt3\Include ?
ReaImDown Posted February 26, 2009 Posted February 26, 2009 ppat said: B.au3 is a totally independent script. It is on a separate encrypted drive with a different letter. I should have put that in the 1st post, the path is G:\B.au3 (instead of C:\B.au3). B.au3and contains passwords, so I cannot put it inside C:\Program Files\AutoIt3\Include. That is why I use the RunWait line.Is there a way to include B.au3 without putting it in C:\Program Files\AutoIt3\Include ?well, you can use registry...text files...or hotkeys (but keep in mind, you would need a) to constantly check for a change in the text file or registry. [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
ppat Posted February 26, 2009 Author Posted February 26, 2009 ReaImDown said: well, you can use registry...text files...or hotkeys (but keep in mind, you would need a) to constantly check for a change in the text file or registry.I am not sure to understand how your answer is relevant to my question?
EndFunc Posted February 26, 2009 Posted February 26, 2009 (edited) ppat said: I am not sure to understand how your answer is relevant to my question?What I would do if I need something like that, is I would have Script B, output to an Ini file and then have Script A read from it and dynamically create the label. I do something like that now, but instead of having a script populate the inifile for the entries. I update it manually. It wouldn't be hard to have one script write to it and the other one read from it. Edited February 26, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it.
Moderators Melba23 Posted February 26, 2009 Moderators Posted February 26, 2009 ppat,You might like to look at this thread. It features a UDF (MessageHandler.au3 from ChrisL) which allows 2 compiled or interpreted scripts to communicate. You need to play with it a bit before you get to understand it fully - but it works really well and is well worth the effort to master it. I was absolutely astonished that AutoIt could do something like this.Given your reservations over WinAPI calls in another thread, I must warn you that it is a pretty complex beast internally - but give it a try, you might get to love it!M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Reveal hidden contents ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
ppat Posted February 27, 2009 Author Posted February 27, 2009 Thanks M23, this looks promissing. it is good to know that it can be done, but my time is limited so I will not investigate the code for now. Eventually, I settled for an easier solution: - in module A.au3, close the GUI before calling B.au3 - in module B.au3, create a new GUI and proceed with all operations within this same module - at the end of B.au3, close the GUI. So in effect, I cannot display the text in one single GUI, but in the end this is acceptable. Thank you everyone for your other interesting suggestions.
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