Sign in to follow this  
Followers 0
pvr02

If a key is pressed send a different key

6 posts in this topic

We have a special application that runs in the UK. Some of our USA based clients use this software as well, but doing some functions, the user needs to press the "F16" button. In the UK this responds to the "Shift F4" key. How would I go about writing an autoit code to check for the key "Shift F4" and if pressed send "F16"?

Is this even possible?

Thanks in advance...

Share this post


Link to post
Share on other sites



This works for me...

#include <misc.au3>
While 1
    If _IsPressed("10") And _IsPressed("73") Then ExitLoop
    Sleep(20)
WEnd
MsgBox(64, "Shift-F4", "Aha! You pressed it!")

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

This works for me...

#include <misc.au3>
While 1
    If _IsPressed("10") And _IsPressed("73") Then ExitLoop
    Sleep(20)
WEnd
MsgBox(64, "Shift-F4", "Aha! You pressed it!")

:)

I used that code and placed it into a folder with the Misc.au3 file and compiled the exe but I am receiving the following:

Line 0 (File "Y:\Applications\autoit-v3\Scripts\F16\F16.exe"):

If _IsPressed("10") and _IsPressed("73") Then ExitLoop

If ^ ERROR

Error: Unknown function name.

Share this post


Link to post
Share on other sites

I used that code and placed it into a folder with the Misc.au3 file and compiled the exe but I am receiving the following:

Line 0 (File "Y:\Applications\autoit-v3\Scripts\F16\F16.exe"):

If _IsPressed("10") and _IsPressed("73") Then ExitLoop

If ^ ERROR

Error: Unknown function name.

The function _IsPressed() is a UDF contained in the include file misc.au3. Did you #include <misc.au3>???

It is also fully documented in the help file. You did read the help file, right?!

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

The function _IsPressed() is a UDF contained in the include file misc.au3. Did you #include <misc.au3>???

It is also fully documented in the help file. You did read the help file, right?!

:)

I checked the Misc.au3 file and it was very basic. I didn't see the function _IsPressed() in it.

#include-once

; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Description:    Functions that assist with Intenet.
;
; ------------------------------------------------------------------------------


;===============================================================================
;
; Function Name:    _Iif()
; Description:      Perform a boolean test within an expression.
; Parameter(s):     $f_Test     - Boolean test.
;                   $v_TrueVal  - Value to return if $f_Test is true.
;                   $v_FalseVal - Value to return if $f_Test is false.
; Requirement(s):   None.
; Return Value(s):  One of $v_TrueVal or $v_FalseVal.
; Author(s):        Dale (Klaatu) Thompson
;
;===============================================================================
Func _Iif($f_Test, $v_TrueVal, $v_FalseVal)
   If $f_Test Then
      Return $v_TrueVal
   Else
      Return $v_FalseVal
   EndIf
EndFunc

Downloaded the newest stable version and it worked like a charm.. Thanks.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

; AutoIt Version: 3.0

Egad, man! The current production version is 3.2.2 and the last Beta I saw was 3.2.3.12! Get with it!

The header for Misc.au3 in the current Prod is:

#include-once
; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1++
; Language:    English
; Description:  Functions that assist with Common Dialogs.
;
; ------------------------------------------------------------------------------

:)

Edit: Oops, guess you figured that out. Missed the last line at the bottom of your post.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0