function error IfWinActive Python with dll AHK Topic is solved

Ask for help, how to use AHK_H, etc.
_dd
Posts: 3
Joined: 11 Jul 2016, 22:06

function error IfWinActive Python with dll AHK

12 Jul 2016, 18:18

Hi, I'm trying to run a code ahk in python, that code is well but when I want to check if any windows is active whitch the function "IfWinActive" show a error
Image

I'm using python with the AuthoHotey.dll,I don't know if this function don't exist in the dll or I have a error :(
Sorry for my english :facepalm:

Code: Select all

from ctypes import *
import time

ahk = cdll.AutoHotkey #load AutoHotkey
ahk.ahktextdll("") #start script in persistent mode (wait for action)
while not ahk.ahkReady(): #wait for AutoHotkey to start
    time.sleep(0.01) #Sleep 100

code = """
ventana()
{
IfWinActive, prueba.ahk - SciTE4AutoHotkey [2 of 2]
{
	MsgBox, 0, , 
	(LTrim
	KKIKSS
	
	
	)
}
}	
"""
ahk.addScript(code) #add script to AutoHotkey

ahk.ahkFunction(u"ventana")
_dd
Posts: 3
Joined: 11 Jul 2016, 22:06

Re: function error IfWinActive Python with dll AHK  Topic is solved

13 Jul 2016, 01:48

Well, I found how to do it. if any has a equal question, that is the solution.

Code: Select all

from ctypes import *
import time
 
ahk = cdll.AutoHotkey #load AutoHotkey
ahk.ahktextdll("") #start script in persistent mode (wait for action)
while not ahk.ahkReady(): #wait for AutoHotkey to start
    time.sleep(0.01) #Sleep 100
 
code = """
ventana()
{
	if WinExist("prueba.ahk - SciTE4AutoHotkey [2 of 2]")
	{
		MsgBox, 0, , 
		(LTrim
		KKIKSS
		)
	}
}	
"""
ahk.addScript(code) #add script to AutoHotkey
 
ahk.ahkFunction(u"ventana")

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 41 guests