AutoHotkey Community

It is currently May 26th, 2012, 10:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: October 23rd, 2009, 11:15 pm 
Hello!

My problem is, I have a numeric keyboard with a "," but most applications use a "." as decimal separator, so I want to replace the numpad comma with a dot.

While a simple "NumpadDot::." works for many applications, it's not enough for Openoffice. For other conveniences, I have to set Openoffice to use comma as decimal separator (which is the standard in my country), but I still want to replace it with a dot in my keyboard.

Openoffice has an option to automatically replace a dot with a comma, but the dot must come from the numpad, which is why "NumpadDot::." doesn't work. I'd have to enter something like NumpadDot::NumpadDot, with the second NumpadDot being a dot. The problem is that it refers to the numpad comma.

Can anyone find a solution for this problem? Thanks in advance.
By the way, AHK rocks! Thanks, devs! :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 12:09 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
Try this :
Code:
NumPadDot::
Send, .


You could always remap the key through windows as well


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 12:26 am 
tekkie2412 wrote:
Try this :
Code:
NumPadDot::
Send, .


You could always remap the key through windows as well


That does about the same as "NumpadDot::.". It outputs the "text dot". I need to output a "numeric keyboard dot", but NumpadDot outputs a numeric comma.

I might also make an exception for Calc, since it's the only program with this problem right now, but it would be nice to know if AHK can handle this in any other way without altering the rest of the system.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 12:41 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
Code:
IfWinActive, Calculator
{
,::.
}


Not sure what you mean by text dot and numeric dot

Edit : How about this?

Code:
NumPadDot::
Send, {ASC 0046}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 12:51 am 
tekkie2412 wrote:
Code:
IfWinActive, Calculator
{
,::.
}


Not sure what you mean by text dot and numeric dot


Thanks, i'll adapt that to my needs.

Well, the dot in the numeric keyboard is not the same as the regular dot. Openoffice recognizes a number if I type it using the numeric keyboard dot, but not the regular dot.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 12:52 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
I just realized you meant openoffice calc, not windows calc :) I think the ascii solution should work even better though.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 12:55 am 
The ASCII code still doesn't work :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 1:51 am 
Sorry for making another post, but I can't edit the last one. I might register later.

I'm trying to set Openoffice as an exception to the hotkey, but it's not working. Here's the code:

IfWinNotActive, ahk_class SALFRAME
{
NumpadDot::.
}

Is there anything wrong? I tried other variations, such as using the title instead of class, but it still didn't work, the replacement is still working on Openoffice.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 1:54 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
You can use the exact title, or you can use SetTitleMatchMode to tell your script, hey, this is close enough.

Code:
SetTitleMatchMode, 2
IfWinNotActive, OpenOffice
{
.....
}


This will cause the script to execute only when calc isnt on top. Is that what you want? Or when it is on top?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 2:01 am 
Offline

Joined: October 24th, 2009, 1:56 am
Posts: 7
Registered, finally.

Well, I want the script to execute when calc isn't on top.
Tried your new suggestion, but it still doesn't work (the script is executing on calc). I don't get it, everything looks right :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 2:09 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
Weird, that should have fixed it, unless something was set to always on top. Mind posting the code? I'll open calc and test it


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 2:16 am 
Offline

Joined: October 24th, 2009, 1:56 am
Posts: 7
I got something. Just the changed the code to this:

NumpadDot::
SetTitleMatchMode 3
IfWinNotActive, ahk_class SALFRAME
{
send, .
}
return

Now it won't give any input on calc, which means the script knows it's the active window. Is there anyway to send a new NumpadDot in an Else statement without making it an infinite loop? Something like this:

NumpadDot::
SetTitleMatchMode 3
IfWinNotActive, ahk_class SALFRAME
{
send, .
}
Else
{
send, NumpadDot
}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 2:18 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
Dragobr wrote:
send, NumpadDot


Should be "Send, {NumPadDot}"

Maybe that will work for ya. You dont have any loops in there either so dont worry about the infinite loop


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 2:25 am 
Offline

Joined: October 24th, 2009, 1:56 am
Posts: 7
I'm getting an error, "71 hotkeys have been received in the last 656ms".

Well, this code is called when I press NumpadDot, so when it calls for NumpadDot inside it, it's calling for itself, entering an infinite loop.

So, there should be another way to organize this function, or something in the syntax to avoid the hotkey calling itself.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 2:28 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
Code:
NumPadDot::
SetTitleMatchMode 2
IfWinNotActive, OpenOffice.org
{
send, .
}
Else
{
send, 0 ;substituted this since I dont have this particular problem
}
return


This worked for me. I got a 0 when I pressed NumPadDot in calc, and I got a . when pressed in notepad.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: AndyJenk, hyper_, JSLover, Leef_me, patgenn123, rbrtryn, XstatyK and 71 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