Jump to content

Recommended Posts

Posted

Gui 1 (myapp1.exe)

Gui 2 (myapp2.exe)

Both are autoIt GUI apps.

Gui 1 has a button that launches Gui 2 and hides Gui 1 in the systray.

So 2 exe's are running at this time.

Gui 2 is on top.

I want to click a button on Gui 2 and have it send a message to Gui 1 for processing.

Will this work with ...

GUI 1

While 1 = 1  

   If WinExists("Isis QB") Then
      AutoItWinSetTitle("Main: Waiting");set waiting text
      WinWait("Isis QB: ");wait for the child to give us a responce
      $responce = WinGetTitle("Isis QB: ");get the full text of the child's window
      AutoItWinSetTitle("Main: IsisQB recieved");let the child know we have the data
      AutoItWinSetTitle("AutoIt v3");reset the title so further children don't get confused
      $MSG = $responce  
   Else
      $MSG = GUIMsg()
   EndIf  

Select   
      Case $MSG = $INCOMINGMSG 
         doSomething () 
EndSelect

and....

GUI 2


While 1 = 1    
   $MSG = GUIMsg()

   #Region - Button events
   Select        
         
      Case $MSG = $CMD_PAUSE
         AutoItWinSetTitle("Isis QB: cmdPause");set our message for the main script
         WinWait("Main: IsisQB recieved");wait for the main script to recieve our message 
         
      Case $MSG = $CLOSE
         ProcessClose ( "isisCommand.exe" )
         
   EndSelect     
   #endRegion      
   sleep(100)
Wend

Make sense? Currently this isn't working but I want to make sure I am on the right track.

Posted (edited)

in case you haven't seen this exmaple, look here I'm afraid I don't remember my exact logic, but I think it's basically the same as your idea.

I"ll see if I can get write some wrappers to simplify multi-window communication..... I'm thinking of scripting functions such as

WinSendData($recipient, $data) ;set recipient's titlebar to data

WinAckData($sender) ;acknowledge data was received? maybe..... :ph34r: ?

WinGetData() ;get's data from own window title

I'm not certain if I only one to use one AutoIt window title or boh ....

EDIT: I like Larry's idea a whole lot more than mine :(

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

This may be a dumbass question but does it still count as a window when it is in the systray with no actual item on the task bar?

Posted

Isn't it a better idea to use AutoItWinSetTitle and AutoItWinGetTitle? That way you aren't required to have a GUI active.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Posted (edited)

Does that inadverdantly answer my questions? If myApp1.exe is in the systray and does not have an active window up on the screen then I can't use the label method from myApp2.exe that does have an active window on the screen?

I don't HAVE to have this fuctionality but then I have to duplicate code, that rubs me the wrong way.

Edited by Hooch
Posted

It has nothing to do with GUI's and taskbar enteries. Every AutoIt script that is run (not matter if has an active taskbar entry, tray icon, or whatever) has a hidden window. This should be used for interprocess communication. It can do the sending of message to a specific program that's waiting (or checking) for message to it, and you can write routines for responding to the communication so that all parties know the info has been recieved.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Posted

Ok, well this is what I am working with:

Parent App:

AutoItWinSetTitle("EDI:0")

While 1 = 1       
   
   $EDI = WinGetTitle("EDI:")
   $EDI_MSG = StringSplit($EDI, ":")
   If $EDI_MSG[2] <> "0" Then
      $MSG = $EDI_MSG[2]       
      AutoItWinSetTitle("EDI:0")      
   Else   
      $MSG = GUIMsg()  
   EndIf

   
   Select   
  
      Case $MSG = "cmdPause"
            MsgBox(0, "test", $MSG)             
   EndSelect

and Child app...

While 1 = 1    
   $MSG = GUIMsg()

   #Region - Button events
   Select        
         
      Case $MSG = $CMD_PAUSE
          AutoItWinSetTitle("EDI:cmdPause")     

         
   EndSelect     
   #endRegion      
   sleep(100)
Wend

It is working in that the parent app receives the command and displays the msgbox. The problem I can't figure out now is that it is looping on it and constantly throwing up the msgbox.

I tried reseting $MSG to 0, and $EDI_MSG[2] to 0 but same deal.... anyone see what I am missing?

Posted

Ok, I had some mess in my select so now it works champ!

So for the record what I have is a main program with the various buttons + a button to launch the "Quick Bar". This sends the parent to the systray and launches a second exe that stays on top.

From there I can execute commands on the parent app. I have to have 2 case statements for each action which sucks but I can live with it.

Thanks for the nudges in the right direction guys!

:ph34r:

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...