[SOLVED]How to determine a script's status remotely?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
amnesiac
Posts: 186
Joined: 22 Nov 2013, 03:08
Location: Egret Island, China
Contact:

[SOLVED]How to determine a script's status remotely?

12 Aug 2014, 20:02

e.g. pause, suspend and so on.

I want to know a script's status before pause a script:

Code: Select all

AHKScriptName := "MyScript.ahk"
DetectHiddenWindows On
SetTitleMatchMode 2
PostMessage, 0x111, 65306,,, %AHKScriptName% ahk_class AutoHotkey ; pause.
AutoHotkey 学习指南(Beauty of AutoHotkey)
I do not make codes, and only a porter of AutoHotkey: from official to Chinese, from other languages to AutoHotkey, and show AutoHotkey to ordinary users sometimes.
lexikos
Posts: 7309
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: How to determine a script's status remotely?

12 Aug 2014, 21:44

SKAN posted a function you can use: http://www.autohotkey.com/board/topic/3 ... /?p=192925

It took much more searching than it should have - several other users have posted code ripped from there without attributing the original source. :x

However, I'm pretty sure SKAN's code is missing a piece, since it refers to A_DetectHiddenWindows but doesn't change it. So here's the full function (untested):

Code: Select all

; SKAN: http://www.autohotkey.com/board/topic/30277-/#entry192925
; Lexikos: http://www.autohotkey.com/forum/viewtopic.php?p=142697#142697
IsPaused( PID ) {
    dhw := A_DetectHiddenWindows 
    DetectHiddenWindows On
    hWnd := WinExist("ahk_class AutoHotkey ahk_pid " PID )
    DetectHiddenWindows %dhw%
    hMenu := DllCall("GetMenu", "uint", hWnd)
    hMenu := DllCall("GetSubMenu", "uint", hMenu, "int", 0)
    return !!(DllCall("GetMenuState", "uint", hMenu, "uint", 4, "uint", 0x400) & 0x8)
}
User avatar
RobertL
Posts: 540
Joined: 18 Jan 2014, 01:14
Location: China

Re: How to determine a script's status remotely?

12 Aug 2014, 22:52

lexikos wrote:It took much more searching than it should have - several other users have posted code ripped from there without attributing the original source. :x
Yes, it's also very dispirited for me to search something, especially I'm not sure about the key word with no direction, and there are too many disperse fragmented posts.
I hope there is an index / catalog /tag / label or something similar. At least, we can try through the index, instead of searching and searching.

Everyone should do their own arranges work well. It's worth to think/do it carefully (, which I'm on trying).
Otherwise, it would be a vicious spiral, people would like to ask, like what I do currently. :(
From About meta-functions change, Properties? \ Brief summary
Fourm (also this thread) has litimted, which has a bias towards procedure of discussion , not the result/conclusion.
What about arrange them to something like Wiki, or just create a new topic version 2.0. :?:
我为人人,人人为己?
User avatar
amnesiac
Posts: 186
Joined: 22 Nov 2013, 03:08
Location: Egret Island, China
Contact:

Re: [SOLVED]How to determine a script's status remotely?

13 Aug 2014, 03:11

Thank you. I'm outdated. haha

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], boiler, melds and 59 guests