Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

winActivate


  • Please log in to reply
5 replies to this topic
Munchee
  • Members
  • 67 posts
  • Last active: Nov 23 2012 02:16 AM
  • Joined: 08 Mar 2010
This is pretty simple but I can't get it to work,

I have a script that will load up two separate programs, but sometimes the second program will sit in front of the first. So I wanna use, Sleep, 5000 to give me time for the programs to load up, then the Winactivate, Window2.

But thats not working, whats the correct way to write it?

  • Guests
  • Last active:
  • Joined: --
what not working
sleep 5000 is not long enough for the programs pop up?
the program exists but WinActivate does no effect to the program?
the second program override the first program and stop first program being activate?

Leef_me
  • Moderators
  • 8125 posts
  • Last active: Today, 06:20 AM
  • Joined: 08 Apr 2009
There are various reasons why it might not be working. Notably first in the list is the method that you use to identify the window to be seen.

For example, the spelling, puntuation and even upper/lower case are important. It is likely best to post your script.

TLM
  • Moderators
  • 3818 posts
  • Last active:
  • Joined: 21 Aug 2006
Leef_me is correct, theres no way for us to know whats going on unless we can see the code.

For instance, it may be much better to use WinWait instead of Sleep.

Its usually something that simple ;).

Munchee
  • Members
  • 67 posts
  • Last active: Nov 23 2012 02:16 AM
  • Joined: 08 Mar 2010
Sorry, I didn't have the script with me when I posted, but at work now so here it is:

#SingleInstance force
#NoTrayIcon

Run, "C:\OTS SYSTEM\Ots SYS - CoinToss\OtsAVTV.exe" /Instance /NoSig "C:\OTS SYSTEM\Ots SYS - CoinToss\Data\CoinToss.oml" "C:\OTS SYSTEM\Ots SYS - CoinToss\Templates\StartupCointoss.otm"
Run, "C:\OTS SYSTEM\AHK and Touch\Touch Screen Proto v1.01\nosaveoption.ahk"
Run, "C:\OTS SYSTEM\AHK and Touch\Touch Screen Proto v1.01\Load Search Settings.ahk"

WinWaitActive, OtsAV TV Broadcaster - Licensed to Orange Door of Orange Door for use on 2 workstations
; Change Title Bar Name to proper
WinSetTitle, Orange Door - Zone 1

Sleep, 5000
WinActivate, Orange Door - Coin Toss



Leef_me
  • Moderators
  • 8125 posts
  • Last active: Today, 06:20 AM
  • Joined: 08 Apr 2009
you wrote of 2 programs but all told you seem to have an external program and two Ahk scripts, besides the script that is running commands

I added #1,2,3, and #A,B,C

It seems to me that #A and #B relate to #1 but something else hasa similar name

so please clarify which of A, B & C relate to 1,2,3 ?

#SingleInstance force
#NoTrayIcon

#1 Run, "C:\OTS SYSTEM\Ots SYS - CoinToss\OtsAVTV.exe" /Instance /NoSig "C:\OTS SYSTEM\Ots SYS - CoinToss\Data\CoinToss.oml" "C:\OTS SYSTEM\Ots SYS - CoinToss\Templates\StartupCointoss.otm"
#2 Run, "C:\OTS SYSTEM\AHK and Touch\Touch Screen Proto v1.01\nosaveoption.ahk"
#3 Run, "C:\OTS SYSTEM\AHK and Touch\Touch Screen Proto v1.01\Load Search Settings.ahk"

#A WinWaitActive, OtsAV TV Broadcaster - Licensed to Orange Door of Orange Door for use on 2 workstations
; Change Title Bar Name to proper
#B WinSetTitle, Orange Door - Zone 1

Sleep, 5000
#C WinActivate, Orange Door - Coin Toss