Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

switch to same window twice deactivate it?


  • Please log in to reply
2 replies to this topic
xahlee
  • Guests
  • Last active:
  • Joined: --
hi, i have this code

#NoTrayIcon
If WinExist("Mozilla Thunderbird")
{
  WinActivate, Mozilla Thunderbird
}
Else
{
  Run "c:/Users/xah/Desktop/Mozilla Thunderbird.lnk"
  WinActivate
}
Return

ExitApp

activated by a key.
but when run twice (sometimes pressed the key twice), it seems to deactivate the window and change mouse position.

how to fix that?

thanks.

Leef_me
  • Moderators
  • 8415 posts
  • Last active: Today, 07:56 AM
  • Joined: 08 Apr 2009
You have not given enough information.

The only way I see that the script can operate as you describe is if
"Mozilla Thunderbird" is not the start of the title.

If the window title has anything before "Mozilla Thunderbird" then the 'if' statement will be false and the script will continue with the 'else' clause.

The 'else' will run another "Mozilla Thunderbird", which might deactivate the current window.

Read the docs on SetTitleMatchMode, with mode 2
<!-- m -->http://www.autohotke... ... chMode.htm<!-- m -->

xahlee
  • Guests
  • Last active:
  • Joined: --
Thanks! that solves it.