AutoHotkey Community

It is currently May 26th, 2012, 11:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: November 16th, 2009, 4:21 pm 
Offline

Joined: April 9th, 2009, 4:11 pm
Posts: 22
Location: Houston, Tx
Recently moved to a new PC, but have made zero changes to
the scripts for my hotstrings.

When entering a shortcut i.e. !s:: to initiate a hotstring,
the hotstring is entered into whatever editor or data field that
I might be working in. However, it is showing each line as if it
is being typed manually
- very quickly, but not instantaneously
as on the previous PC.

I can see each line of text being entered as if by hand, one keystroke
at a time. Previously, the text strings (paragraphs) would be inserted
instantly to whatever editor I was using at the moment.

For hotstrings that contain multiple lines of text strings, I also
lose keyboard control
. I can no longer use arrow keys or backspace
as an example. I have to initiate another hotstring that contains
only one line of text to regain keyboard control.

Suggestions??

Thanks,
weg


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 4:26 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Look at setkeydelay, your keyboard settings may differ from your previous PC (slower). Also look at setbatchlines, -1

For longer hotstrings try the paste method and send the clipboard
Code:
Send ^v
It is probably faster and more reliable.

If you want to keep the original clipboard contents see "ClipboardAll (saving and restoring everything on the clipboard)" for an example on how to do that:
http://www.autohotkey.com/docs/misc/Clipboard.htm

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2009, 2:06 pm 
Offline

Joined: April 9th, 2009, 4:11 pm
Posts: 22
Location: Houston, Tx
Thanks for the reply.

I am using SendMode Input which makes Send synonomous with SendInput. Both ignore SetKeyDelay according to Help.

SetBatchLines didn't change anything.

I'm reading up on your ClipBoard approach, but still am wondering
what changed to cause this problem. Keep in mind, I'm losing keyboard
control after the hotstring inserts the text.

Here is one of the hotstrings I'm using.
Code:
!c:: ;Inserts Contact Log info

TodayMinus := A_Now
EnvAdd, TodayMinus, -3, days(
FormatTime, TodayMinus, %TodayMinus%, M/d/yy
SendInput %TodayMinus% -dg- reviewed client issues & involvement`n
SendInput Client gave me authority to negotiate.`n`n

TodayMinus := A_Now
EnvAdd, TodayMinus, -6, days
FormatTime, TodayMinus, %TodayMinus%, M/d/yy
SendInput %TodayMinus% -dg- em'd client non-participation advisory`n
SendInput %TodayMinus% -dg- emailed client request for new OIR`n
SendInput %TodayMinus% -dg- contact attempt w/client`n
Return


Then, here is a short one that I now have to use to regain keyboard control.

Code:
!d::  ;Inserts Supplement date
FormatTime, DateString,,M/d/yy
Send %DateString% -dg- report finished and submitted for supplementation.`n
Return


Thanks,
weg


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2009, 2:44 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Try one of the other sends so you can use setkeydelay (also you at your keyboard settings in the OS)

Not sure what you mean by focus, but you can store the and restore the current window and or control before and after sending the text (still think sending clipboard is the fastest and most reliable way IMHO)

Re focus, look at WinGet, ControlGetFocus, ControlFocus it may help,
here is a snippet from one of my scripts where I use functions but
there is no need for that actually.
Code:
CursorIn := GetActiveControl()
ActiveWindow := GetActiveWindow()
WinActivate AHK_ID%ActiveWindow%
ControlFocus, %CursorIn%, AHK_ID%ActiveWindow%

GetActiveControl()
{
WinGet, Active_Window_ID, ID, A
ControlGetFocus, ActiveControl, A,
Return,  ActiveControl
}

GetActiveWindow()
{
WinGet, Active_Window_ID, ID, A
return, Active_Window_ID
}

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2009, 3:30 pm 
Offline

Joined: April 9th, 2009, 4:11 pm
Posts: 22
Location: Houston, Tx
HugoV,

Where did I make a reference to 'focus'?
I'm missing what you're saying.

". . . but you can store the ? and restore the current window and or control before . . ."

Thank you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2009, 8:06 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
wideeyedguy wrote:
Where did I make a reference to 'focus'?
I'm missing what you're saying.
That is how I read it / understand it, the text is send but if you type afterwards nothing happens is that correct? In that case I asume either your window has lost focus or the focus on the control is lost (edit1 in notepad for example is the area where you type).
wideeyedguy wrote:
". . . but you can store the ? and restore the current window and or control before . . ."Thank you.
By explicitly retreiving the control and or window that has focus / is active you can make sure it still has focus AFTER the text has been sent.

Did you check your keyboard settings in the OS? Please answer this question, 3rd time I ask not going to again :wink:

And again, try pasting the clipboard it WILL be faster, more reliable etc.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 7:50 pm 
Offline

Joined: April 9th, 2009, 4:11 pm
Posts: 22
Location: Houston, Tx
I appreciate your patience.

How do I "check" my keyboard settings in the OS?

Perhaps if we step aside from the issue of the textstrings
and focus on why I'm losing keyboard functionality then I
can put up with the slowness of the textstrings.

weg


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 7:53 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Start -> Control panel -> keyboard, properties and look at the repeat delay and repeat rate, perhaps they are set to SLOW (there should be a slider)
http://www.theeldergeek.com/images/HT2_ ... 171530.gif

2nd thing you could look at would be your BIOS settings, "Typematic Delay"
http://www.pcguide.com/ref/mbsys/bios/s ... eDelay.htm

Have you tried other Send methods, how about regular send?

What OS are you using XP, Vista or Win7

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:49 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
wideeyedguy wrote:
Code:
!c::

TodayMinus := A_Now
EnvAdd, TodayMinus, -3, days( <-- is this a typo?
FormatTime, TodayMinus, %TodayMinus%, M/d/yy
SendInput %TodayMinus% -dg- reviewed client issues & involvement`n
SendInput Client gave me authority to negotiate.`n`n

TodayMinus := A_Now
EnvAdd, TodayMinus, -6, days
FormatTime, TodayMinus, %TodayMinus%, M/d/yy
SendInput %TodayMinus% -dg- em'd client non-participation advisory`n
SendInput %TodayMinus% -dg- emailed client request for new OIR`n
SendInput %TodayMinus% -dg- contact attempt w/client`n
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 1:46 pm 
Offline

Joined: April 9th, 2009, 4:11 pm
Posts: 22
Location: Houston, Tx
a_h_k,

Appears it was a typo, but has zero effect on the script
or the issue I'm having.

Any ideas to solve my problem?

Thanks,
weg


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 1:57 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Have you looked at the delay in the OS and Bios? Pasting the text may be the only solution left unless you experiment with ControlSend ... (would be hard to loose focus using that I suppose)

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 5:51 pm 
Offline

Joined: April 9th, 2009, 4:11 pm
Posts: 22
Location: Houston, Tx
Keyboard rate is set to fast, from what I can see for those settings.

I've been experimenting with the ClipBoard paste method
and am not "gettin' it". I'm sure this is due to my limited understanding
of variables/expressions. Trying to read and understand.

What would a couple of the lines from the snippet I gave here
look like converted over to the ClipBoard method?

weg


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:42 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Try this
Code:
!c::
ClipboardSave:=ClipboardAll
TodayMinus3 := A_Now
TodayMinus6 := A_Now
EnvAdd, TodayMinus3, -3, days
EnvAdd, TodayMinus6, -6, days
FormatTime, TodayMinus3, %TodayMinus3%, M/d/yy
FormatTime, TodayMinus6, %TodayMinus6%, M/d/yy
;MsgBox % TodayMinus3
;MsgBox % TodayMinus6
Clipboard=
(join`n
%TodayMinus3% -dg- reviewed client issues & involvement
Client gave me authority to negotiate.

%TodayMinus6% -dg- em'd client non-participation advisory
%TodayMinus6% -dg- emailed client request for new OIR
%TodayMinus6% -dg- contact attempt w/client
)
;MsgBox % Clipboard
Send ^v
Clipboard:=ClipboardSave
ClipboardSave=
Return


Edit: perhaps your repeat is too fast? Have you tried other send methods? (if you don't answer questions it only makes it harder to help you)

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2009, 12:03 am 
Offline

Joined: April 9th, 2009, 4:11 pm
Posts: 22
Location: Houston, Tx
As you can see from the two snippets I pasted as examples,
I have used 'SendInput' and 'Send'.

Since the Help notes state that SendInput Mode makes Send synonomous with SendInput, I didn't see much to be gained by using Send, even though I had in some of the single-string Hotstrings.
According to Help, both ignore SetKeyDelay, so wasn't sure how your suggestion could be implemented. Help states that SendInput is the fastest method of sending keystrokes - "nearly instantaneous".

Perhaps I've overlooked another Send command that you're referring to in your questions. And, not certain when I would use SetKeyDelay if they ignore that setting.

Changing the keyboard settings, via Control Panel, is having zero effect on keystroke delivery to the screen or preventing loss of keyboard action as described in the original post.

Your Clipboard snippet is beautiful and is how I will modify each of my hotstrings. Also helps me to see how I should sequence the variables and setting statements. I will update you if I still have the keyboard problem after updating all of my strings and putting to use.

Disappointing to not deduce the cause of the original problem, but at least I have a new method to produce the intended result.

weg


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2009, 11:28 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Look again at the http://www.autohotkey.com/docs/commands/Send.htm you will sendplay sendevent might be worth experimenting with and have a look at http://www.autohotkey.com/docs/commands/SendMode.htm as well so you can still use send and easily try another method with modifying your hotstrings/hotkeys...

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cerberus, Google [Bot], Leef_me, Maestr0, rbrtryn, XstatyK, Yahoo [Bot] and 73 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group