Jump to content

Reprogramming F keys


Recommended Posts

Hi,

I need to reprogram some F keys. The code below works fine except F12. 

; Script Start - Add your code below here

HotKeySet("{F10}", "SendKeys")
HotKeySet("{F9}", "SendKeys1")
HotKeySet("{F8}", "SendKeys2")
HotKeySet("{F7}", "SendKeys3")
HotKeySet("{F6}", "SendKeys4")
HotKeySet("{F5}", "SendKeys5")
HotKeySet("{F12}", "SendKeys9")
While 1
 Sleep(100)
WEnd
Func SendKeys()
     send ("000")
   send("{enter}")
EndFunc
 func SendKeys1()
 send("996")
send("{enter}")
endfunc
Func SendKeys2()
  send("997")
  send("{enter}")
  EndFunc
  func sendkeys3()
  Send("998")
send ("{enter}")
EndFunc
Func SendKeys4()
   send("995")
   send("{enter}")
endfunc
Func sendkeys9()
send(0;134;10p$e[0;72;5p)
send(0;75;19p$e[0;77;4p)
send(0;80;24p$e[0;82;22p)
send(0;83;7p)
send("{enter}")
  endfunc

I need F12 to be like a linefeed - to reload the last entered

The following works when I run a file called ansi.bat. I don't know anything about this but I think the first 4 lines are for F12

prompt $e[0;134;10p$e[0;72;5p
prompt $e[0;75;19p$e[0;77;4p
prompt $e[0;80;24p$e[0;82;22p
prompt $e[0;83;7p
prompt $e[0;68;"000";13p
prompt $e[0;67;"996";13p
prompt $e[0;66;"997";13p
prompt $e[0;65;"998";13p
prompt $e[0;64;"995";13p
prompt $e[0;60;"994";13p
prompt $e[0;59;"quit";13p
rem prompt $e[0;84;"999";13p
prompt $P$G

Any help greatly appreciated

Regards

Geoff

Link to comment
Share on other sites

It is good practice to check the hotkeyset() return code.

You would find that F12 is already occupied by Windows.

_HotKey("{ESC}")
_HotKey("{F12}")
Func _HotKey($hotkey = "")
;       ! ALT  + SHIFT  ^ CONTROL  # WinKey
    Switch @HotKeyPressed
        Case "{ESC}"
            Exit 0*MsgBox(64 + 262144, Default, "Exit", 1)
        Case "{F12}"
            MsgBox(64+262144, Default, "F12 pressed. Should NOT occur since already reseved by Windows. ",0)
        Case Else
            If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed,15)
            If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.",15)
    EndSwitch
EndFunc   ;==>_HotKey

While Sleep(10000)     ; here should be your application.
    MsgBox(64+262144, Default, "Press ESC to exit",3)
WEnd                 ; meanwhile, here is a dummy loop.

 

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

I am running DOS programs under NTVDM and I use my file ansi.bat so change some F keys. I guess windows lets go of F12 when NTVDM is running cause it works. If you  hit F12 the current field is filled with what you typed in that field in the last record. It is really handy when looking for records with similar keys. I am starting to use vDos instead of NTVDM and ansi.bat won't work with vDos. That is why I had to write the autoit script.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...