AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Replacing Numpad , with .
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Dragobr
Guest





PostPosted: Fri Oct 23, 2009 10:15 pm    Post subject: Replacing Numpad , with . Reply with quote

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! Very Happy
Back to top
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Fri Oct 23, 2009 11:09 pm    Post subject: Reply with quote

Try this :
Code:

NumPadDot::
Send, .


You could always remap the key through windows as well
Back to top
View user's profile Send private message
Dragobr
Guest





PostPosted: Fri Oct 23, 2009 11:26 pm    Post subject: Reply with quote

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.
Back to top
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Fri Oct 23, 2009 11:41 pm    Post subject: Reply with quote

Code:

IfWinActive, Calculator
{
,::.
}


Not sure what you mean by text dot and numeric dot

Edit : How about this?

Code:

NumPadDot::
Send, {ASC 0046}
Back to top
View user's profile Send private message
Dragobr
Guest





PostPosted: Fri Oct 23, 2009 11:51 pm    Post subject: Reply with quote

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.
Back to top
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Fri Oct 23, 2009 11:52 pm    Post subject: Reply with quote

I just realized you meant openoffice calc, not windows calc Smile I think the ascii solution should work even better though.
Back to top
View user's profile Send private message
Dragobr
Guest





PostPosted: Fri Oct 23, 2009 11:55 pm    Post subject: Reply with quote

The ASCII code still doesn't work Sad
Back to top
Dragobr
Guest





PostPosted: Sat Oct 24, 2009 12:51 am    Post subject: Reply with quote

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.
Back to top
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Sat Oct 24, 2009 12:54 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Dragobr



Joined: 24 Oct 2009
Posts: 7

PostPosted: Sat Oct 24, 2009 1:01 am    Post subject: Reply with quote

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 Confused
Back to top
View user's profile Send private message
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Sat Oct 24, 2009 1:09 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Dragobr



Joined: 24 Oct 2009
Posts: 7

PostPosted: Sat Oct 24, 2009 1:16 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Sat Oct 24, 2009 1:18 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Dragobr



Joined: 24 Oct 2009
Posts: 7

PostPosted: Sat Oct 24, 2009 1:25 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Sat Oct 24, 2009 1:28 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group