Jump to content

script problem- unselects with ispressed


flick
 Share

Recommended Posts

While 1

If _IsPressed("h") Then

Send("{p down}")

Sleep(250)

EndIf

If _IsPressed("o") Then

Send("{p up}")

Sleep(250)

WEnd

Func _Quit()

Exit

EndFunc ;==>_Quit

rather than doing the hotkey on top of what i'm manually clicking, it cancels everything i have selected.

how can i fix this?

Link to comment
Share on other sites

While 1

If _IsPressed("h") Then

Send("{p down}")

Sleep(250)

EndIf

If _IsPressed("o") Then

Send("{p up}")

Sleep(250)

WEnd

Func _Quit()

Exit

EndFunc ;==>_Quit

rather than doing the hotkey on top of what i'm manually clicking, it cancels everything i have selected.

how can i fix this?

You need to read the help for _IsPressed. In the help it lists the codes to be used for each key, you don't use the key letter as you do for Send. (I assume yoiu want to detect when the keys for h and o are pressed.)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

You need to read the help for _IsPressed. In the help it lists the codes to be used for each key, you don't use the key letter as you do for Send. (I assume yoiu want to detect when the keys for h and o are pressed.)

i actually edited my real script which has the numbers in it

my problem is, when i use the script(which does work) it unselects everything i'm already doing. so the hotkey / unhotkey does work, but it messes up with what i'm doing.

Link to comment
Share on other sites

i actually edited my real script which has the numbers in it

my problem is, when i use the script(which does work) it unselects everything i'm already doing. so the hotkey / unhotkey does work, but it messes up with what i'm doing.

You posted code which you know is wrong and have already corrected, but you don't post the code which would help us to understand what your problem is or know what you mean by your hotkey.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

You posted code which you know is wrong and have already corrected, but you don't post the code which would help us to understand what your problem is or know what you mean by your hotkey.

While 1

If _IsPressed("72") Then

Send("{p down}")

Sleep(250)

EndIf

If _IsPressed("74") Then

Send("{p up}")

Sleep(250)

WEnd

Func _Quit()

Exit

EndFunc ;==>_Quit

my problem is when i hit those hotkeys, it does hit p(which is the key i want it to hit) but it also makes what i have selected with my mouse unselect

Edited by flick
Link to comment
Share on other sites

While 1

If _IsPressed("72") Then

Send("{p down}")

Sleep(250)

EndIf

If _IsPressed("74") Then

Send("{p up}")

Sleep(250)

WEnd

Func _Quit()

Exit

EndFunc ;==>_Quit

my problem is when i hit those hotkeys, it does hit p(which is the key i want it to hit) but it also makes what i have selected with my mouse unselect

Ah, I see it is a misunderstanding. Those are not hot keys.

If you have selected some text then hitting a key would normally replace the selected text with the key you type unless it is in something like an edit set to read only.

Can you explain more about what you are selecting and what you want to happen when p is pressed?

Is the text in your own gui or in another application?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

"P" is an in game command that needs to be held down for a combo

but i only need it held down when I hit f3(which needs to send aswell) and f4 should cancel both without interfering with what I'm selecting.

and the file is just a .au3 script, I edited the default one... it works now (sends f3/p same time, f4 cancels) but it cancels what I'm doing in between.

Edited by flick
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...