Problem

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DeepMind
Posts: 271
Joined: 19 Jul 2016, 14:47

Problem

20 Oct 2016, 10:01

this annoying Babylon (translator program) message will come up every now and then when I click on the sound button on babylon window that says if you want to buy more sounds for your babylon software, so I tried to get rid of it with assigning all keys to close that message if it exist, but when I execute this code (a part a bigger script), afaik it should use Alt & q for closing the message window if that window exist, I also defined Alt & q to reload open script inside Scite, but when I execute this code (below) my alt & q doesn't reload script in scite, as it always does, and it literally does nothing, I'm just posting this, in case I'm doing something wrong in this code:

Code: Select all

#IfWinExist, Babylon Message ahk_exe Babylon.exe
Alt & q::
q::
w::
e::
r::
t::
y::
u::
i::
o::
p::
[::
]::
a::
s::
d::
f::
g::
h::
j::
k::
l::
;::
'::
\::
z::
x::
c::
v::
b::
n::
m::
,::
.::
/::
LButton::
RButton::
MButton::
Enter::
Ctrl::
Shift::
alt::
space::
tab::
CapsLock::
esc::
AppsKey::
lwin::
rwin::
	SetMouseDelay, -1
	SetKeyDelay, -1
	WinKill
	return
I'm gonna try putting settimer for this purpose if I couldn't figure this out, but my pc is too slow, and I'm afraid it's gonna make it worse
also if anybody have any better idea would be much appreciate
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: Problem

20 Oct 2016, 11:11

Try this (untested)...

Code: Select all

; The following line goes at the very top of your existing AHK file.
SetTimer, KillBabylonMessage, 250

; Everything below here goes at the bottom of your existing AHK file.
KillBabylonMessage:
IfWinExist, Babylon Message ahk_exe Babylon.exe
    WinKill, Babylon Message ahk_exe Babylon.exe
Return
DeepMind
Posts: 271
Joined: 19 Jul 2016, 14:47

Re: Problem

21 Oct 2016, 02:00

Shadowpheonix wrote:Try this (untested)...

Code: Select all

; The following line goes at the very top of your existing AHK file.
SetTimer, KillBabylonMessage, 250

; Everything below here goes at the bottom of your existing AHK file.
KillBabylonMessage:
IfWinExist, Babylon Message ahk_exe Babylon.exe
    WinKill, Babylon Message ahk_exe Babylon.exe
Return
thanks :), that works great, it doesn't slow my whole computer that's awesome. So 250 means it gets executed every 250 ms right?
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Problem

21 Oct 2016, 02:14

Code: Select all

; The following line goes at the very top of your existing AHK file.
SetTimer, KillBabylonMessage, -1

; Everything below here goes at the bottom of your existing AHK file.
KillBabylonMessage:
Loop
{
    Winwait, Babylon Message ahk_exe Babylon.exe
        WinKill, Babylon Message ahk_exe Babylon.exe
}
Return
Also see Winwait.
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: Problem

24 Oct 2016, 09:46

DeepMind wrote:So 250 means it gets executed every 250 ms right?
Correct.

The method Helgef posted will likely perform even better. I always forget about WinWait when doing tasks like this.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 268 guests