Sign in to follow this  
Followers 0
ppat

Modify the GUI created by an other script?

8 posts in this topic

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?

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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 by EndFunc

EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0