tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
5
Task/OLE-Automation/AutoHotkey/ole-automation-1.ahk
Normal file
5
Task/OLE-Automation/AutoHotkey/ole-automation-1.ahk
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
ahk := comobjactive("ahkdemo.ahk")
|
||||
ahk.hello("hello world")
|
||||
py := ComObjActive("python.server")
|
||||
py.write("hello")
|
||||
return
|
||||
56
Task/OLE-Automation/AutoHotkey/ole-automation-2.ahk
Normal file
56
Task/OLE-Automation/AutoHotkey/ole-automation-2.ahk
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#Persistent
|
||||
CLSID_ThisScript := "{38A3EB13-D0C4-478b-9720-4D0B2D361DB9}"
|
||||
APPID_ThisScript := "ahkdemo.ahk"
|
||||
funcs := ["aRegisterIDs", "aGetObject", "aCallFunc", "hello"]
|
||||
server := ahkComServer(CLSID_ThisScript, APPID_ThisScript, funcs)
|
||||
return
|
||||
|
||||
aRegisterIDs(this, CLSID, APPID){
|
||||
RegisterIDs(CLSID, APPID)
|
||||
}
|
||||
|
||||
hello(this, message){
|
||||
msgbox % message
|
||||
}
|
||||
aGetObject(this, name){
|
||||
global
|
||||
return %name%
|
||||
}
|
||||
|
||||
aCallFunc(this, func, args){
|
||||
return %func%(args)
|
||||
}
|
||||
|
||||
;; ahkcomserver()
|
||||
ahkComServer(CLSID_ThisScript, APPID_ThisScript, funcs)
|
||||
{
|
||||
global serverReady
|
||||
server := object()
|
||||
; CLSID_ThisScript := "{38A3EB13-D0C4-478b-9720-4D0B2D361DB9}"
|
||||
; APPID_ThisScript := "Garglet.QueryServer"
|
||||
|
||||
RegisterIDs(CLSID_ThisScript, APPID_ThisScript)
|
||||
for i, func in funcs
|
||||
{
|
||||
str .= func . ", "
|
||||
}
|
||||
str := SubStr(str, 1, strlen(str) - 2)
|
||||
|
||||
myObj := ComDispatch("", str)
|
||||
; Expose it
|
||||
if !(hRemote := ComRemote(myObj, CLSID_ThisScript))
|
||||
{
|
||||
MsgBox, 16, %A_ScriptName%, Can't remote the object!
|
||||
ExitApp
|
||||
}
|
||||
server.CLSID := CLSID_ThisScript
|
||||
server.APPID := APPID_ThisScript
|
||||
server.hRemote := hRemote
|
||||
serverReady := 1
|
||||
return server
|
||||
}
|
||||
|
||||
#Include ComRemote.ahk
|
||||
#include lib\ComDispTable.ahk
|
||||
#include lib\ComDispatch.ahk
|
||||
#include lib\ComVar.ahk
|
||||
Loading…
Add table
Add a link
Reference in a new issue