shift key is being pressed on and off and i dont know why

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
NewberEnerNeeder
Posts: 7
Joined: 15 Dec 2015, 22:10

shift key is being pressed on and off and i dont know why

12 Jan 2016, 19:29

ummm okay well i thought i had a good working script but it still kinda works.

The problem is i think when it sends the info to the notepad i think maybe some how the shift button is being pressed on and off because words like ahk_id come back as ahk-id or the numbers 843 comes back as *43 on the notepad like shift is being held down for a moment once in a while, even some words in like the title coMe bAck witH caPs oN.

does anyone have an idea how to fix this?




Code: Select all


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force
SetBatchLines -1


pause
loop
{
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
MouseGetPos, xpos, ypos
ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control%`nX%xpos% Y%ypos%
}
return

f1::pause, toggle
return

F2::
{
IfWinNotExist, Untitled - Notepad
run, notepad     
  sleep 200
WinWait ahk_class Notepad
controlSend,Edit1, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control%`n %xpos% %ypos% `n `n,Untitled - Notepad
}
Return

f3::reload
 



f1 to start script
f2 to send info to note pad
f3 to reload

anyone know why? or how to fix?
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: shift key is being pressed on and off and i dont know why

13 Jan 2016, 08:36

Bear in mind that Send A with hold shift because you asked it to send an upper case A.
Conversely, if shift was held and you did Send a it would release shift, hit a, then hold shift.

To stop this behavior, put {Blind} at the start of the send: Send {Blind}a
NewberEnerNeeder
Posts: 7
Joined: 15 Dec 2015, 22:10

Re: shift key is being pressed on and off and i dont know why

13 Jan 2016, 11:39

evilC wrote:Bear in mind that Send A with hold shift because you asked it to send an upper case A.
Conversely, if shift was held and you did Send a it would release shift, hit a, then hold shift.

To stop this behavior, put {Blind} at the start of the send: Send {Blind}a





well, hmm...

this is the line of code i use to send with:

Code: Select all

controlSend,Edit1, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control%`n %xpos% %ypos% `n `n,Untitled - Notepad
i dont think i am pressing shift anywhere in the whole script.

also it is random sometimes when i send the mousegetpos to the notepad 2x in a row as a test the caps will be in different spots not the same spots.

i really have no idea why this is happening
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: shift key is being pressed on and off and i dont know why

13 Jan 2016, 11:46

if any of the following variables hold upper-case letters (or any other character that requires holding shift to type), the script will hold shift during the send:

id
class
title

Furthermore, you are sending the string "ahk_class".
An _underscore_ requires shift to type.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: coder96, Joey5, RandomBoy and 340 guests