AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AutoHotkey.dll
Goto page Previous  1, 2, 3, 4, 5, 6 ... 34, 35, 36  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Wed Aug 19, 2009 1:34 pm    Post subject: Reply with quote

Hi tinku99,

ahkLabel and ahkFunction work well, also script is launched on addFile.

That's fantastic, thank you Smile

I noticed 1 small problem, when you try to execute a label or function of first script launched by DllCall("...\ahkdll",...), instead of displaying an error message program crashes Confused
IsLabel and IsFunc work fine, they both return 0.
Can this be fixed?

Also I noticed that when a MsgBox is shown from previous script and you call addFile, nothing happens.
If you get ExitThread + TerminateThread + Relaunch to work, this should be implemented here, I think. (simmilar to a reload in AutoHotkey.exe)
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Thu Aug 20, 2009 6:05 am    Post subject: ahkdll update 9.9 Reply with quote

Fixed bug: when you tried to execute a label or function that didn't exist, the script crashed.
Also, ahkFunction now allows 2 parameters. Still does not return the return value of the target function, because it is sort of an asynchronous call within autohotkey through a msgmonitor type function.
HotKeyIt wrote:

I noticed that when a MsgBox is shown from previous script and you call addFile, nothing happens.
Are you sure? After you click away the MsgBox, see which script is active... For me the new one is and the old one isn't.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Thu Aug 20, 2009 12:59 pm    Post subject: Reply with quote

Thanks tinku99,

I see now script is loaded fine but addfile script will not run when I press OK on MsgBox.

E.g. when you load following script (do not press OK) and then addfile it again and press OK (first MsgBox), second script will not run, though it is loaded fine.

Code:
#Persistent
MsgBox % A_TickCount


Btw. do ahkFunction, ahkLabel and addFile return a pointer to the function, label, line?
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Fri Aug 21, 2009 5:52 pm    Post subject: msgbox prevents new scripts autoexecute section from running Reply with quote

HotKeyIt wrote:

I see now script is loaded fine but addfile script will not run when I press OK on MsgBox.
Btw. do ahkFunction, ahkLabel and addFile return a pointer to the function, label, line?

Will fix it in the next release.
ahkFunction and ahkLabel return 0 on success, -1 if no such function or label exists.
In the future ahkFunction will return the result of the function call.
You can use FindFunc() (exported in the dll) to get a pointer to the function.

addfile returns a pointer to the first line in the newly added script.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Sat Aug 22, 2009 7:07 pm    Post subject: ahkLabel and ahkFunction broken Reply with quote

modifying the msgsleep function broke something.
Reverting temporarily.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Sat Aug 22, 2009 9:21 pm    Post subject: update 0.993 Reply with quote

ok, fixed ahklabel and ahkfunction again in v0.993.
You still have manually cleanup any running threads / msgboxes before overwriting the current script.
Recycling hotkeys is not supported between late includes yet.
That is next main thing to do.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sat Aug 22, 2009 11:43 pm    Post subject: Reply with quote

Cool Very Happy
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sun Aug 23, 2009 4:32 pm    Post subject: Reply with quote

Hi tinku99,

how about to change the window class of AutoHotkey.dll to AutoHotkeyDll and AutoHotkeyDllGUI?
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Thu Aug 27, 2009 5:58 am    Post subject: window class Reply with quote

HotKeyIt wrote:
Hi tinku99,
how about to change the window class of AutoHotkey.dll to AutoHotkeyDll and AutoHotkeyDllGUI?

sure, in the next release Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Thu Aug 27, 2009 8:38 am    Post subject: Reply with quote

Great Very Happy
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sun Aug 30, 2009 2:24 pm    Post subject: Reply with quote

Hi tinku99,

As I understand A_AhkPath in AutoHotkey.dll is reporting correct AutoHotkey.exe path but how do I get the path of dll?

As I understand to use exported function by the dll itself, I would need that or is there another way to call AddFile from Dll itself?
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Mon Aug 31, 2009 2:19 am    Post subject: Reply with quote

HotKeyIt wrote:
how do I get the path of dll?
is there another way to call AddFile from Dll itself?

You should already know the path of the dll if you loaded it...
But I will add a built in variable for the path of the dll in the next version.
You may not need the full path to call functions in the dll from itself... try
Code:
DllCall("AutoHotkey.dll\addFile", "str", "lateadded.ahk", "uchar", 1,"uchar" , 0, "Cdecl UInt")
Alternatively you can just use the builtin function
Code:
import("lateadded.ahk", 1, 0)

same thing for adding files from AutoHotkey_N.exe...
Code:
DllCall("AutoHotkey.exe\addFile", "str", "lateadded.ahk", "uchar", 1,"uchar" , 0, "Cdecl UInt")
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Mon Aug 31, 2009 3:37 am    Post subject: Reply with quote

Thanks tinku99,

I cannot get it to work using DllCall("AutoHotkey.exe\addfile",...

Import works fine in exe and dll but it does not work with pipes Confused

Any chance import could accept text instead of file as well?
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Mon Aug 31, 2009 4:41 am    Post subject: addFile, pipes, import Reply with quote

HotKeyIt wrote:

I cannot get it to work using DllCall("AutoHotkey.exe\addfile",...

Import works fine in exe and dll but it does not work with pipes Confused
you have to use addFile, not addfile. Case is important...
for pipes: see this comment by Lexikos
Code:
; AutoHotkey reads the first 3 bytes to check for the UTF-8 BOM "". If it is
; NOT present, AutoHotkey then attempts to "rewind", thus breaking the pipe.
Script := chr(239) chr(187) chr(191) Script

If you did this and its still not working, i am not sure... will look into it.
Quote:
Any chance import could accept text instead of file as well?
yes, will probably add this feature eventually.[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Mon Aug 31, 2009 5:00 am    Post subject: Reply with quote

Thanks tinku99,

I didn't know it is case sensitive, works fine now.

Here is my pipe example, it stucks when calling addFile.
When i change dwOpenMode to 1 it processes addFile but stucks at ConnectNamedPipe:
Code:
PIPE_NAME_ := A_TickCount
PIPE_GA_ := DllCall("CreateNamedPipe","str","\\.\pipe\" PIPE_NAME_,"uint"
               ,2,"uint",0,"uint",255,"uint",0,"uint",0,"uint",0,"uint",0)
PIPE_    := DllCall("CreateNamedPipe","str","\\.\pipe\" PIPE_NAME_,"uint"
               ,2,"uint",0,"uint",255,"uint",0,"uint",0,"uint",0,"uint",0)
if (PIPE_=-1 or PIPE_GA_=-1) {
   MsgBox CreateNamedPipe failed
}
DllCall(A_AhkPath . "\addFile","str","\\.\pipe\" . PIPE_NAME_,"Uchar",1,"Uchar",1,"Cdecl UInt")
MsgBox file added
DllCall("ConnectNamedPipe","uint",PIPE_GA_,"uint",0)
MsgBox pipe connected
DllCall("CloseHandle","uint",PIPE_GA_)
DllCall("ConnectNamedPipe","uint",PIPE_,"uint",0)
Script := chr(239) . chr(187) . chr(191) . "#Persistent`nGo:`nMsgBox pipe`nReturn"
if !DllCall("WriteFile","uint",PIPE_,"str",script,"uint",StrLen(script)+1,"uint*",0,"uint",0)
   MsgBox WriteFile failed: %ErrorLevel%/%A_LastError%
DllCall("CloseHandle","uint",PIPE_)
MsgBox
DllCall(A_AhkPath . "\ahkLabel", "str", "go", "Cdecl UInt")


It works fine using AutoHotkey.exe
Code:
PIPE_NAME_ := A_TickCount
PIPE_GA_ := DllCall("CreateNamedPipe","str","\\.\pipe\" PIPE_NAME_,"uint"
               ,2,"uint",0,"uint",255,"uint",0,"uint",0,"uint",0,"uint",0)
PIPE_    := DllCall("CreateNamedPipe","str","\\.\pipe\" PIPE_NAME_,"uint"
               ,2,"uint",0,"uint",255,"uint",0,"uint",0,"uint",0,"uint",0)
if (PIPE_=-1 or PIPE_GA_=-1) {
   MsgBox CreateNamedPipe failed
}
Run % A_AhkPath . " \\.\pipe\" . PIPE_NAME_
MsgBox file added
DllCall("ConnectNamedPipe","uint",PIPE_GA_,"uint",0)
MsgBox pipe connected
DllCall("CloseHandle","uint",PIPE_GA_)
DllCall("ConnectNamedPipe","uint",PIPE_,"uint",0)
Script := chr(239) . chr(187) . chr(191) . "#Persistent`nGo:`nMsgBox Pipe`nReturn"
if !DllCall("WriteFile","uint",PIPE_,"str",script,"uint",StrLen(script)+1,"uint*",0,"uint",0)
   MsgBox WriteFile failed: %ErrorLevel%/%A_LastError%
DllCall("CloseHandle","uint",PIPE_)
MsgBox

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6 ... 34, 35, 36  Next
Page 5 of 36

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group