Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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 ?

Posted

  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]
Posted
  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?
Posted (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 by EndFunc
EndFuncAutoIt is the shiznit. I love it.
  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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

 

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...