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
  • Guests
  • Last active:
  • Joined: --
hi, i have this code

If WinExist("Mozilla Thunderbird")
  WinActivate, Mozilla Thunderbird
  Run "c:/Users/xah/Desktop/Mozilla Thunderbird.lnk"


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?


  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 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 -->

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