AutoHotkey Community

It is currently May 26th, 2012, 8:34 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 563 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 38  Next
Author Message
 Post subject:
PostPosted: August 19th, 2009, 2:34 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Hi tinku99,

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

That's fantastic, thank you :)

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 :?
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:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: ahkdll update 9.9
PostPosted: August 20th, 2009, 7:05 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 20th, 2009, 1:59 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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:


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 21st, 2009, 6:52 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 22nd, 2009, 8:07 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
modifying the msgsleep function broke something.
Reverting temporarily.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: update 0.993
PostPosted: August 22nd, 2009, 10:21 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 23rd, 2009, 12:43 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Cool :D

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 23rd, 2009, 5:32 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: window class
PostPosted: August 27th, 2009, 6:58 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
HotKeyIt wrote:
Hi tinku99,
how about to change the window class of AutoHotkey.dll to AutoHotkeyDll and AutoHotkeyDllGUI?

sure, in the next release :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 27th, 2009, 9:38 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Great :D

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2009, 3:24 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 3:19 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 4:37 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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 :?

Any chance import could accept text instead of file as well?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: addFile, pipes, import
PostPosted: August 31st, 2009, 5:41 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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 :?
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]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 6:00 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 563 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 38  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group