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 ... 17, 18, 19, 20, 21, 22, 23 ... 38  Next
Author Message
 Post subject: wiki page
PostPosted: October 14th, 2010, 2:04 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
hoppfrosch wrote:
(One more hint to overthink the structure/contents of the first topic of this thread ...)
I have updated the first page a little. More usefully, started a page on the wiki. Feel free to organize.

@HotkeyIt: Thanks for the com interface to Autohotkey.dll. I have a use for it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 15th, 2010, 5:44 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
First off, I apologize if this is just a Ruby question & should go in the General Chat section, but I was trying to get the COM interface to work in Ruby. I've gotten it in VB, JScript, & Lua, but I get the following AHK Error when embedding in Ruby:
Quote:
Line Text: 眒怴睠岤$䉀%
Error: This line does not contain a recognized action.
Code:
require "WIN32OLE"

ahk = WIN32OLE.new("AutoHotkey.Script")
print ahk.AhkTextDll("MsgBox, AHK in Ruby")

gets

Again, I'd assume this is just an issue with Ruby & encoding, but I was wondering if anybody had any ideas on how to get this working correctly.

(Also, the Line Text shows up as $% in the Error MsgBox, it's just readable on this webpage)

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 15th, 2010, 5:50 pm 
Offline

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

Have you tried both, ANSI and UNICODE dlls?

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2010, 7:10 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Yes, I tried both - ANSI & Unicode. They don't give me the same gibberish, but it's the same error message with gibberish. Also, I confirmed that the COM interface works with Python.

It might be beneficial if you posted some examples using the methods of the COM interface. Maybe it's just me, but I'm having trouble understanding exactly how all the methods (functions) operate, especially in relation to each-other.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2010, 1:14 pm 
Offline

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

Can you pm me how to test ruby, don't have time to read docs :?:

I will update docs soon. Here are all methods.
Code:
ahktextdll([in,optional] VARIANT script,[in,optional] VARIANT options,[in,optional] VARIANT params, [out, retval] unsigned int* hThread);
ahkdll([in,optional] VARIANT filepath,[in,optional] VARIANT options,[in,optional] VARIANT params, [out, retval] unsigned int* hThread);
ahkPause([in,optional] VARIANT aChangeTo,[out, retval] BOOL* paused);
ahkReady([out, retval] BOOL* ready);
ahkFindLabel([in] VARIANT aLabelName,[out, retval] unsigned int* pLabel);
ahkgetvar([in] VARIANT name,[in,optional] VARIANT getVar,[out, retval] BSTR* returnVal);
ahkassign([in] VARIANT name,[in,optional] VARIANT value,[out, retval] unsigned int* success);
ahkExecuteLine([in,optional] VARIANT line,[in,optional] VARIANT aMode,[in,optional] VARIANT wait,[out, retval] unsigned int* pLine);
ahkLabel([in] VARIANT aLabelName,[in,optional] VARIANT nowait,[out, retval] BOOL* success);
ahkFindFunction([in] VARIANT FuncName,[out, retval] unsigned int* pFunc);
ahkFunction([in] VARIANT FuncName,[in,optional] VARIANT param1,[in,optional] VARIANT param2,[in,optional] VARIANT param3,[in,optional] VARIANT param4,[in,optional] VARIANT param5,[in,optional] VARIANT param6,[in,optional] VARIANT param7,[in,optional] VARIANT param8,[in,optional] VARIANT param9,[in,optional] VARIANT param10,[out, retval] BSTR* returnVal);
ahkPostFunction([in] VARIANT FuncName,[in,optional] VARIANT param1,[in,optional] VARIANT param2,[in,optional] VARIANT param3,[in,optional] VARIANT param4,[in,optional] VARIANT param5,[in,optional] VARIANT param6,[in,optional] VARIANT param7,[in,optional] VARIANT param8,[in,optional] VARIANT param9,[in,optional] VARIANT param10,[out, retval] unsigned int* returnVal);
ahkKey([in] VARIANT name,[out, retval] BOOL* success);
addScript([in] VARIANT script,[in,optional] VARIANT replace,[out, retval] unsigned int* success);
addFile([in] VARIANT filepath,[in,optional] VARIANT aAllowDuplicateInclude,[in,optional] VARIANT aIgnoreLoadFailure,[out, retval] unsigned int* success);
ahkExec([in] VARIANT script,[out, retval] BOOL* success);
ahkTerminate([in,optional] VARIANT kill,[out, retval] BOOL* success);

VARIANT uses always bstr. So you need to make sure that you are passing a string:
Code:
Thread:=ComObjCreate("AutoHotkey.Script")
thread.ahktextdll("MsgBox %1%",1 "","")
While Thread.ahkReady()
   Sleep 100

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2010, 6:56 pm 
Offline

Joined: August 8th, 2008, 3:29 am
Posts: 121
Hi HotkeyIt,

I get an access violation when calling ahkExec() with any parameter. The DLL tries to use a null pointer in the ahkExec function. I rebuilt the DLL with hopefully a fix for it, but I may not have done it correctly because calling ahkExec with "MsgBox" does nothing and returns TRUE. I'm calling ahkExec directly, not using COM.

The null pointer is oldLastLine in the ahkExec function. It's accessed unchecked in multiple places, such as line 394, 400, 401, and 415 in exports.cpp.

If I wanted to contribute to the project, do you allow developers to commit directly to the repository, or should they submit a patch?

Here are some of errors I had when building the solution the first time:
    1. Compiling the head revision with Visual C++ 2010 Express:
    1>pcre\pcre_valid_utf8.c(78): error C2059: syntax error : 'type'
    It looks like the function _pcre_valid_utf8 is supposed to be replaced by a macro with the same name, but it's causing an error with the original function. I'm using C++ 2010 Express. I fixed this on my local copy by excluding it from the build, but the repository still has this.

    2. The default include/lib directories on my machine don't have the ATL headers and libs. I added absolute paths for them in the project properties, but I'll need to work out a better solution to create patches or commit normally, so if you have an idea why that is please let know. It might help other potential contributors.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 18th, 2010, 11:36 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Fixed COM byref parameters wrote:
- Ruby works now
- Many String parameters do accept integers as well now
- - e.g. ahk.ahktextdll("MsgBox %1%",1,1)

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 19th, 2010, 1:05 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Fixed COM byref parameters wrote:
- Ruby works now

Confirmed :D - your turnaround time is impressive :!: Thanks for the hard work.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 19th, 2010, 7:21 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Thank you, I'm glad it works fine now ;)

@drifter, this was fixed before, sorry I have not uploaded latest project files earlier.
- The best would be if you create a separate git repository I think?
- - I can then take over your changes when agreed.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 19th, 2010, 8:29 am 
Offline

Joined: August 8th, 2008, 3:29 am
Posts: 121
It seems I was using it wrong too, I never called ahkdll or ahktextdll. I have it working now. I had a look at the source code, and ...thanks a lot! Salute. And, I'd like to remain a humble user. Chris' code subjugates the computer like no other, it's invaluable, and irreplicable. Praise God it is being libytized, for it is too powerful to remain bound.


Last edited by drifter on October 21st, 2010, 12:13 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 20th, 2010, 8:26 pm 
Offline

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


I have finally found the reason why Input command and Hotkeys as well as Hotstrings were not working when dll file was missing.
This was happening as well when using AhkDllThread() because it loads dlls from Memory unsing same file (AutoHotkey.dll).

Now we can have a full working multi-threaded AutoHotkey without using multiple AutoHotkey.dll's.

Simple Example for multithreaded Hotkey (Rbutton).
When compiled, it will use internal AutoHotkey.dll so your compiled script will not require a copy of AutoHotkey.dll.

Code:
If 0 ;FileInstall is only required when for compiled scripts,
   FileInstall,AutoHotkey.dll,AutoHotkey.dll
Loop 2 ;load and start threads
   dll%A_Index%:=AhkDllThread("AutoHotkey.dll") ;Create new Thread
   ,dll%A_Index%.ahktextdll("~RButton::`n" ;Load a script for Threads
                           . "While % GetKeyState(""RButton"",""P"")`n"
                           . "`nToolTip Thread" A_Index ",," A_Index*-20
                           . "`nToolTip`nReturn")
   
MsgBox Main Thread, Press Right Mouse Button`nPress OK to restart threads.

Loop 2 ;Start both Threads again (they will be terminated automatically!)
   dll%A_Index%.ahktextdll("~RButton::`n"
                           . "While % GetKeyState(""RButton"",""P"")`n"
                           . "ToolTip New Thread``nThread# " A_Index ",," A_Index*-40
                           . "`nToolTip`nReturn")
   
MsgBox Main Thread, Press Right Mouse Button`n Press OK to Exit

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


Last edited by HotKeyIt on October 20th, 2010, 10:13 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 20th, 2010, 8:56 pm 
Offline

Joined: February 29th, 2008, 8:36 pm
Posts: 901
Location: Vault 7
Congrats on finally finding it!
Now I can finally use AhkDllThread!

_________________
ImageDebugging,Container,FileContainer,Object Preferences,ShellFileOperation


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2010, 7:29 pm 
Offline

Joined: August 8th, 2008, 3:29 am
Posts: 121
Please, disregard: The following issue appears with any AutoHotkey, and is caused by Vista and Windows 7. Please disregard. It can be fixed by running the script as an Administrator.

Is it me, or does BlockInput not do anything. The following script function executes and returns successfully, but neither the keyboard nor mouse input is blocked for any amount of time:

Code:
TestBlockInput()
{
   BlockInput, On
   sleep 5000
   BlockInput, Off
   return "Function completed successfully"
}


OS: Windows 7 64-bit
AutoHotkey.dll: 64-bit Unicode

I called the script function from Managed code after loading the DLL with the ahktextdll API.
Other functions in the script work fine, and so does Sleep.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2010, 8:48 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Have a look here
Does Input function work? This way you could interrupt Keyboard!?

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2010, 9:29 pm 
Offline

Joined: August 8th, 2008, 3:29 am
Posts: 121
Yes, thanks HotkeyIt. It turns out it was the Vista problem. You have to run the script as an Administrator. It works now, thanks!


Last edited by drifter on October 21st, 2010, 11:23 pm, edited 1 time in total.

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 ... 17, 18, 19, 20, 21, 22, 23 ... 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