AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with Code...Focus in the wrong place

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
iamnu



Joined: 31 May 2007
Posts: 23

PostPosted: Wed Nov 18, 2009 10:01 am    Post subject: Help with Code...Focus in the wrong place Reply with quote

When I refer to "Focus", I am mean the Active Window (I'm not sure of the proper terminology).

When this code runs, the Focus goes to somewhere other than "The DownLoader".

When complete, I want the Focus to be on "The DownLoader".

Can someone explain how this is done?

Code:
#M::
IfWinExist MetaStock Professional
{
MsgBox,0,,MetaStock is Running
   IfWinExist The DownLoader
   {
   MsgBox,0,,The DownLoader is running
   } 
   else
   {
   Run C:\Program Files\Equis\The DownLoader\Dlwin.exe, C:\Program Files\Equis\The DownLoader\
   Return
   }
}
else
{
   Run C:\Program Files\Equis\MetaStock\Mswin.exe,,max
   WinWaitActive MetaStock Professional,,5
   Run C:\Program Files\Equis\The DownLoader\Dlwin.exe, C:\Program Files\Equis\The DownLoader\
   WinWaitActive The DownLoader,,50
; MsgBox,0,,Activating the Downloader
   WinActivate The DownLoader
   Return
}


[ Moderator!: Applied [Code] tags ]
Back to top
View user's profile Send private message
a_h_k



Joined: 02 Feb 2008
Posts: 344

PostPosted: Wed Nov 18, 2009 10:47 am    Post subject: Reply with quote

Code:
#M::
  IfWinExist, MetaStock Professional
  {
    MsgBox,0,,MetaStock is Running,1

    IfWinExist The DownLoader
      MsgBox,0,,The DownLoader is running,1
    Else
    {
      Run C:\Program Files\Equis\The DownLoader\Dlwin.exe, C:\Program Files\Equis\The DownLoader\
      WinWait, The DownLoader
    }
  }
  Else
  {
    Run C:\Program Files\Equis\MetaStock\Mswin.exe,,max
    WinWaitActive, MetaStock Professional

    Run C:\Program Files\Equis\The DownLoader\Dlwin.exe, C:\Program Files\Equis\The DownLoader\
    WinWait, The DownLoader
  }
  WinActivate, The DownLoader
  WinWaitActive, The DownLoader
  MsgBox,0,,The Downloader is now Active!,1
Return


Make sure it works first, and then if need be i'll (or someone) will explain it

Ps: Use [code]<your code here>[/(slash)code] to put code in scrolling window


Last edited by a_h_k on Thu Nov 19, 2009 12:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
iamnu



Joined: 31 May 2007
Posts: 23

PostPosted: Wed Nov 18, 2009 1:07 pm    Post subject: Reply with quote

The term WinWaitExist produces a syntax error.

One more point of interest here...The DownLoader Window is not active with my original code, but the DownLoader "item" in the Taskbar is active. When I move my mouse over the "item" in the Taskbar, The DownLoader Window becomes active. Strange...
Back to top
View user's profile Send private message
a_h_k



Joined: 02 Feb 2008
Posts: 344

PostPosted: Thu Nov 19, 2009 12:18 pm    Post subject: Reply with quote

iamnu wrote:
The term WinWaitExist produces a syntax error

Sorry, that should be just "WinWait" (i have made the correction)

iamnu wrote:
The DownLoader Window is not active with my original code, but the DownLoader "item" in the Taskbar is active. When I move my mouse over the "item" in the Taskbar, The DownLoader Window becomes active

You mean it's loaded as "minimized" to the taskbar? (ie "becomes" just a "button")?
When move (not click?) mouse over the button, does it then pop-up as a window?
Back to top
View user's profile Send private message
iamnu



Joined: 31 May 2007
Posts: 23

PostPosted: Thu Nov 19, 2009 12:44 pm    Post subject: Reply with quote

Oh, thank you! It works fine now, just like I wanted.

FYI, I had to change two lines of code back to the original way I had them, as follows:

Run C:\Program Files\Equis\MetaStock\Mswin.exe,,max
WinWaitActive MetaStock Professional,,5
Run C:\Program Files\Equis\The DownLoader\Dlwin.exe, C:\Program Files\Equis\The DownLoader\
WinWaitActive The DownLoader,,50

Without the 5 and 50 at the end of the second and fourth line, "The DownLoader" didn't get executed.

Thanks again for your help...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group