AutoHotkey Community

It is currently May 27th, 2012, 1:31 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 563 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 38  Next
Author Message
PostPosted: August 31st, 2009, 7:28 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Here it is:
documentation


Report this post
Top
 Profile  
Reply with quote  
 Post subject: pipes with import()
PostPosted: August 31st, 2009, 8:22 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
HotKeyIt wrote:
When i change dwOpenMode to 1 it processes addFile but stucks at ConnectNamedPipe
import() and connectnamedpipe() are waiting for each other. It works with the dll, because the dll is in a different thread than the host.
If you make the pipe in a separate process or thread, it can work...
Regardless, this is too much trouble, i will just implement adding files from variables eventually.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: pipes with import()
PostPosted: August 31st, 2009, 9:19 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
tinku99 wrote:
import() and connectnamedpipe() are waiting for each other. It works with the dll, because the dll is in a different thread than the host.

I thought that it cannot for same process :(
tinku99 wrote:
If you make the pipe in a separate process or thread, it can work...
Regardless, this is too much trouble, i will just implement adding files from variables eventually.


After reading your help file and experimenting a little with FileAppend I found something much better and much more efficient :D
Can you tell me if this will work in future releases :)



:oops:
I was wrong :(
I thought stdout is also a pipe but a file is being created :(

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


Last edited by HotKeyIt on August 31st, 2009, 5:58 pm, edited 4 times in total.

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

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

there is a problem when loading a function via Import or addFile when you are inside a function, can you fix :)
Code:
Func()
t:="funct"
MsgBox % %t%()
ExitApp

Func(){
   FileDelete,stdout
   FileAppend,funct(){`nReturn 1`n},stdout
   DllCall(A_AhkPath . "\addFile","str","stdout","uchar", 1,"uchar" , 1, "Cdecl UInt")
}

_________________
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, 5:50 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
HotKeyIt wrote:
Hi tinku99,

there is a problem when loading a function via Import or addFile when you are inside a function, can you fix :)
Code:
Func()
t:="funct"
MsgBox % %t%()
ExitApp

Func(){
   FileDelete,stdout
   FileAppend,funct(){`nReturn 1`n},stdout
   DllCall(A_AhkPath . "\addFile","str","stdout","uchar", 1,"uchar" , 1, "Cdecl UInt")
}

maybe the parser and the green threads are using the same variable to indicate the state of being in a function. Will look into it for the next release.
Meanwhile, you can use gosub in the function:
Code:
fx()
t:="latefunc"
MsgBox % %t%()
return
fx()
{
gosub load
return 1
}
 
load:
import("lateinclude.ahk")
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 9:34 pm 
Offline

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

Thank you, will do so :)

Do you have any idea why Input command is not working in Dll, looks like it does not receive input :?

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: updates
PostPosted: September 12th, 2009, 1:41 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Plugin architecture is nearing completion: preview
AutoHotkey.dll is facilitating my linux port of ahk: ahkx
HotKeyIt wrote:
Do you have any idea why Input command is not working in Dll, looks like it does not receive input :?
It works for me
Code:
#Persistent
DllCall(A_ScriptDir . "\AutoHotkey.dll\ahkdll"
, "str", "input.ahk", "Cdecl Int")
input.ahk from the help file
Code:
msgbox input
Input, UserInput, V T5 L4 C, {enter}.{esc}{tab}, btw,otoh,fl,ahk,ca
if ErrorLevel = Max
{
    MsgBox, You entered "%UserInput%", which is the maximum length of text.
    return
}
if ErrorLevel = Timeout
{
    MsgBox, You entered "%UserInput%" at which time the input timed out.
    return
}
if ErrorLevel = NewInput
    return
IfInString, ErrorLevel, EndKey:
{
    MsgBox, You entered "%UserInput%" and terminated the input with %ErrorLevel%.
    return
}
; Otherwise, a match was found.
SetKeyDelay, -1  ; Most editors can handle the fastest speed.
if UserInput = btw
    Send, {backspace 4}by the way
else if UserInput = otoh
    Send, {backspace 5}on the other hand
else if UserInput = fl
    Send, {backspace 3}Florida
else if UserInput = ca
    Send, {backspace 3}California
else if UserInput = ahk
    Run, www.autohotkey.com
return



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2009, 11:19 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
tinku99 wrote:
It works for me

This is odd :?
For me your example terminates with ExitCode -1073741819 a second after Input command is reached.
I am on XPSP3 using latest AutoHotkey_N.exe and AutoHotkey.dll.
Can anybody else test above example?

EDIT:
Using my Thread function it does not terminate :?, but UserInput is empty after it times out

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: input
PostPosted: September 12th, 2009, 8:25 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Make sure you load the library first in the host script:
Code:
#Persistent
ahkdll := DllCall("LoadLibrary", "str", A_ScriptDir . "\AutoHotkey.dll")
DllCall(A_ScriptDir . "\AutoHotkey.dll\ahkdll"
, "str", "input.ahk", "Cdecl Int")
I had skipped the loadlibrary line in the script above...


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: input
PostPosted: September 12th, 2009, 10:23 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
tinku99 wrote:
Make sure you load the library first in the host script.
:oops:

I see now, the problem comes from renaming AutoHotkey.dll :?
:!: AutoHotkey.dll must be in same folder as script (so it does not get copied) :!:
Code:
#Persistent
ahkdll := "AutoHotkey_" A_TickCount . ".dll"
FileMove, % A_ScriptDir . "\AutoHotkey.dll", %ahkdll%
DllCall("LoadLibrary", "str", ahkdll)
FileMove, %ahkdll%,% A_ScriptDir . "\AutoHotkey.dll"

thread_ := DllCall(A_ScriptDir . "\AutoHotkey.dll\ahkdll", "str", A_ScriptDir . "\input.ahk","Cdecl Int")

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2009, 11:13 pm 
Offline

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

I've tried to compile using the AutoHotkeySC.bin of latest version but I get an error, what is wrong :?
Quote:
Error: Error opening the destination file.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: AutoHotkeySC.bin
PostPosted: September 12th, 2009, 11:53 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
I hadn't update the bin file for a while...
here is an update: AutoHotkey_N10.zip

By the way, I am not sure I want to change the classname of the autohotkey.dll window... It will break existing scripts.
Also, the A_ahkpath returns the host executable, which is appropriate i think... the path of the dll is the path that the executable loaded... maybe i'll make a separate builtin variable for it someday.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: AutoHotkeySC.bin
PostPosted: September 13th, 2009, 12:42 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
tinku99 wrote:
I hadn't update the bin file for a while...
here is an update: AutoHotkey_N10.zip

By the way, I am not sure I want to change the classname of the autohotkey.dll window... It will break existing scripts.
Also, the A_ahkpath returns the host executable, which is appropriate i think... the path of the dll is the path that the executable loaded... maybe i'll make a separate builtin variable for it someday.


What is new in the update, I still get the same error when trying to compile :?

A separate builtin variable A_DllPath would be 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: AutoHotkeySC.bin
PostPosted: September 13th, 2009, 1:46 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Sorry, i had changed the output directory of AutoHotkeySC.bin and it broke the postbuild script. Its fixed now. Please redownload
> what's new
see changelog


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2009, 9:15 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Thank you :)

_________________
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 ... 3, 4, 5, 6, 7, 8, 9 ... 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