AutoHotkey Community

It is currently May 26th, 2012, 1:59 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 152 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10, 11  Next
Author Message
 Post subject:
PostPosted: January 10th, 2009, 5:49 am 
Offline

Joined: November 9th, 2008, 7:48 pm
Posts: 25
So has anyone found a reliable way to actually override the default actions of buttons/keypresses, not just detect them and perform a different action in addition to the original action?

I'm trying to get my Harmony Remote to send commands directly to Windows Media Center without stealing focus from the active window which more often than not for me is a full-screen game.

My problem is two part, the first relates to this thread and the aforementioned default actions still occuring.

The second part is that Windows Vista Media Center is a DirectX application and as such ControlSend doesn't work. Meaning I probably would have to use PostMessages, but Window Spy/Winspector Spy also don't work with DirectX apps, and I have not found a list of messages for Vista Media Center.

If anyone can help with either please do!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 8:05 pm 
Offline

Joined: January 14th, 2008, 9:10 pm
Posts: 35
Location: Germany
rockum wrote:
elmulti wrote:
It deactivates the normal scrolling function and then makes one wheel scroll vertical and the other horizontal.
If your device number is not 4, you need to adjust the script.

@Ucla: It should be no problem to change this to what you need. Just change the content of "MouseWheelActions".

Let me know if this works you you.
Happy New Year,
elmulti


Does that mean you've found a way to deactivate normal function of keys too?

Thanks

Kind of, but not really. I used the following lines to deactivate the WheelUp and WheelDown functions:
Code:
; deactivate normal wheel-action
$WheelUp::
$WheelDown::
   ; do nothing
Return
Then I used Micha's DLL to detect these functions anyways and to detect which wheel was used. I then programmed one wheel to scroll horizontally and the other to scroll vertically.

One could use this scheme for keyboard-keys as well, but it probably only works for single keys like letters, not for modifier keys like Shift or Control. If you need to reprogram a whole keyboard, this is not a good approach. It might work, but it would need a lot of work.

John Burgos wrote:
Hey, looks you have done a nice jod.... maybe you can help me out, im new with AutoHotkey, but what I want to do is to be able to remap my external USB HID Keyboard keys (but only remapping the external HID, without affecting the keys of the HID keyboard included in my laptop).

I have read the basics and followed some tutorials, but so far I can only remap keys but afecting both keyboards... Is there a way to only chose one keyboard to remap???

Hope you can help me out, since I tryied to understand your code, but it is too advanced for me...

Thanks in advance

John
As you can see in my recent posts here, it is possible to add special functionality to specific keys of an HID. It is tricky to stop this key from performing its default function, though.
What exactly do you have in mind? Which keys should be remapped and do you need to deactivate the default functionality?

You should start in following the link in the first post. Please read the whole page that Micha wrote, download the archive and try his "AutoHotkeyRemoteControlDLL.ahk" script.
Please play around with the script and try adjusting the "RemoteControl.ahk" script. Then if you get stuck, let me know the details and I'll try to help you out.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 8:16 pm 
Offline

Joined: January 14th, 2008, 9:10 pm
Posts: 35
Location: Germany
Blahman wrote:
So has anyone found a reliable way to actually override the default actions of buttons/keypresses, not just detect them and perform a different action in addition to the original action?

I'm trying to get my Harmony Remote to send commands directly to Windows Media Center without stealing focus from the active window which more often than not for me is a full-screen game.

My problem is two part, the first relates to this thread and the aforementioned default actions still occuring.

The second part is that Windows Vista Media Center is a DirectX application and as such ControlSend doesn't work. Meaning I probably would have to use PostMessages, but Window Spy/Winspector Spy also don't work with DirectX apps, and I have not found a list of messages for Vista Media Center.

If anyone can help with either please do!
Sorry for the double post, but I overlooked one post...

@Blahman:
I'm still looking for a better way to overwrite a key function, but You see my current approach in the above post. Unfortunately this only works for standard keys, e.g. it doesn't work for the DVD button on my remote control.
You might be able to solve the focus problem by renaming the file "ehtray.exe" in "C:\Windows\ehome". This is the background program from Media Center which captures media keys if Media Center is not active.
I don't know any Messages to send to WMC though.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 11:32 pm 
Offline

Joined: November 9th, 2008, 7:48 pm
Posts: 25
Thanks for the tip, that might be very useful if I can get the other bit (sending messages) working.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 21st, 2009, 2:19 am 
Offline

Joined: September 25th, 2006, 7:13 pm
Posts: 6
Location: Peru
Hallo elmulti, vielen Danke für deine Hilfe!
I want to show my particular recognition to your answer on page 8. Your script is very nice, although has some difficulties I hope they will be surmonted.
1. A window appears occasionally that disables only the scrolling of wheels, not the other functions of mouse, with the following message:
GetWM_INPUTHIDData failed. Errorcode: 0

Clicking on button "Okey", the window disappears and the script continues well. This occasional window is permanently disabled removing the next lines of code:
Code:
; if (errorlevel <> 0) || (nRC == 0xFFFFFFFF)
; {
;    MsgBox GetWM_INPUTHIDData failed. Errorcode: %errorlevel%
;    goto cleanup
; }
And the script runs fine.

2. The initial deactivation of wheels is apparently right. Eliminating the following code, or adding ~ at first of each line:
Code:
$WheelUp::
$WheelDown::
   ; do nothing
Return
causes the new mouse front wheel assignments not to function. V.g. in Explorer and Notepad the wheel scrolls upwards-left or downwards-right simultaneously, and in Office 2007 (Word, Excel, PowerPoint) and Mozilla Firefox scrolls only vertically, not horizontally. The rear wheel (vertical scroll) works fine.

3. Conserving this previous code, both wheels work well in most of my applications, but the front wheel (horizontal scroll) doesn't run (it's motionless) in Office 2007 applications and Firefox (ok in Microsoft Internet Explorer). I've tried it works introducing the directive #IfWinActive and ahk_classes into Word (ahk_class OpusApp), Excel (ahk_class XLMAIN), PowerPoint (ahk_class PP12FrameClass), and Firefox (ahk_class MozillaUIWindowClass), in vain.
Can you or somebody please help me with this?

4. Both wheels works fine, according to Ucla's request on page 8:
FOREMOST WHEEL upward send, {w}
FOREMOST WHEEL downward send, {s}
REARWHEEL upward send, {e}
REARWHEEL downward send, {d}

But if Caps Lock or Shift keys are pressed the result is always lowercase letters.

5. All the previous one is for Windows-32 bit. Micha's AutohotkeyRemoteControl.dll and AutoHotkeyRemoteControlDLL.ahk (and elmulti's script) do not work on Windows Vista x64 bit. In Micha's script, after I hit "Register" button, and then press any key or mouse click, Windows closes inopportunely AutoHotkeyRemoteControlDLL.ahk. The Windows message is:
"AutoHotkey has stopped working
Windows can check online for a solution the problem"
Then gives these two options:
"Check online for a solution and close the program.
Close the program"
Details:
"Problem signature:
Problem Event Name: APPCRASH
Application Name: Autohotkey.exe
..."

elmulti's script is also immediately closed after some movement of mouse, then appears that message. But Windows doesn't close my script Autohotkey.ini (with other hotkeys), and Autohotkey.exe continues running ok. But if I introduce the code from elmulti's script in my script, it crashes. Micha's DLL and scripts are only for Windows-32 bit.
When we will have a version of 64 bits of that fabulous dll?

With best of best regards.
Sorry my English.

_________________
¿Cuándo traducimos AHK al español?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2009, 5:27 pm 
Offline

Joined: January 14th, 2008, 9:10 pm
Posts: 35
Location: Germany
Right now I can't do anything to make Micha's DLL work on a 64bit system, but if Micha could share the source code, one could play around with it!?
I read somewhere in the forum, that Micha's DLL could completely be replaced by lots of AHK-code, but I didn't fund the code and unfortunately I can't write it myself.

@Cholito:
My script from page 8 uses the horizontal scrolling command via SendMessage. For programs that don't support it, workarounds must be found. In this thread, there is some useful code that more or less works for Word and some other programs. If you can't get it to work, let me know.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: script writer
PostPosted: January 26th, 2009, 6:39 pm 
When I loaded AHK on my laptop, I wrote a script and it worked great. I started another one and needed the script writer for it and a box popped up that said "dll load failed". any ideas?


Report this post
Top
  
Reply with quote  
 Post subject: Re: script writer
PostPosted: January 26th, 2009, 7:54 pm 
Offline

Joined: January 14th, 2008, 9:10 pm
Posts: 35
Location: Germany
msanders wrote:
When I loaded AHK on my laptop, I wrote a script and it worked great. I started another one and needed the script writer for it and a box popped up that said "dll load failed". any ideas?

Hello msanders!
I think you are asking this question at the wrong place, unless you downloaded Micha's "AutoHotkeyRemoteControlDLL" and tried to make it work.
Please make a thread in the Ask for Help section and include your script or at least a few more infos.
Good luck!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2009, 1:02 am 
hi, is there any way to make this work in vista?or another similar dll that work in vista? i'm actually trying to use it in seven...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2009, 10:44 am 
Offline

Joined: April 1st, 2009, 10:37 am
Posts: 1
Location: Northern Ireland
Hey everyone, I am still getting the error code -3 with the latest version of this software... I was trying to follow the guide here to assign the Fn key on my new apple bluetooth wireless keyboard, but when trying to detect the HID's I get the error:

"GetDeviceCount fehlgeschlagen. Errorcode: -3"

Its a brand new install of Windows XP (had a crash a few days ago) with no updates installed... I suspect that the lack of updates/ hotfixes is the cause of the error but would like someone to confirm this for me... FYI I am not installing Windows updates at present because SP3 was what actually caused my OS crash in the first place, it has some major issues at the moment and caused a major conflict with a new driver that I installed earlier in the week.

Any help would be greatly appreciated here, I am eager to get my new keyboard working properly in windows! Thanks in anticipation,

Matt.

_________________
Matt Nesbitt
Unicorn Systems
Bespoke Perfoemance PC's
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2009, 12:27 am 
Offline

Joined: November 15th, 2005, 11:15 am
Posts: 537
Location: Germany
Unicorn_Systems wrote:
Hey everyone, I am still getting the error code -3 with the latest version of this software...

Hi are you sure have you installed the vc-redist?
Ciao
Micha


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 18th, 2009, 8:29 pm 
Offline

Joined: March 8th, 2009, 12:30 am
Posts: 9
Any solution for continuous button pressing?
i.e. when I press a button and don't leave it I want it to send multiple messages.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 18th, 2009, 10:53 pm 
bxr wrote:
Any solution for continuous button pressing?
i.e. when I press a button and don't leave it I want it to send multiple messages.

If you do not release the button, there's no release event.
You can i.e use SetTimer.
Start a timer if pressed and while no release event triggers, do what you want multiple times#
ciao
micha


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2009, 9:54 am 
Offline

Joined: May 14th, 2009, 9:53 am
Posts: 1
micha as guest wrote:
bxr wrote:
Any solution for continuous button pressing?
i.e. when I press a button and don't leave it I want it to send multiple messages.

If you do not release the button, there's no release event.
You can i.e use SetTimer.
Start a timer if pressed and while no release event triggers, do what you want multiple times#
ciao
micha

This is exactly what I want to do.

How can I do this with SetTimer. I'm completely new to this. Thanks! :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2009, 4:57 pm 
Offline

Joined: November 15th, 2005, 11:15 am
Posts: 537
Location: Germany
Hi glitch00,
for example:
Code:
^a::
SetTimer, DoAction ,300, Priority
return

^b::
SetTimer, DoAction, Off
tooltip,
return

DoAction:
tooltip, Action active %A_TickCount%
return


If you press the key start the timer (^a::....). After you have started the timer the label DoAction is called periodically. Do there what you want the script to do. I.E. Send, {home}

If you release the button, the up-event is triggered. Stop the Timer
(^b:: ....)

Ciao
Micha


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 152 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10, 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: c0ntinuity, Yahoo [Bot] and 16 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