Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Send, {Sleep 100} or Send, {100ms}


  • Please log in to reply
50 replies to this topic
  • Guests
  • Last active:
  • Joined: --

I have got scripts that would be 2 pages long if there was not that feature,

Why don't you just write a function for it.

jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009
@Guest:
Alright, I'm going to call you on this one. Are you purposely trying to create a circular argument? This is the Wish List forum - hence the wish & reasons for the wish. Demonstrations of functions have already been provided. Oddly enough, it seems like several users have written functions for this - therefore confirming that it is desirable functionality. However, as you are again trying to point out, it is not required functionality - as there are workarounds. But then again, we are in the Wish List forum ...

Also, note that I have to assume that you're the same guest because you aren't signed in.

  • Guests
  • Last active:
  • Joined: --

Alright, I'm going to call you on this one. Are you purposely trying to create a circular argument?

Not at all. I just suggested a solution for his particular problem. What's wrong with that.

Demonstrations of functions have already been provided.

Which means a workaround has been already provided. Then why did he still claim the suggest as if there had not been a solution yet? That appears he is creating a circular argument from my view.

Also, note that I have to assume that you're the same guest because you aren't signed in.

There are more than one guest besides me in this thread. Note that you won't know which one is which in this forum allowing anonymous guests. This is irrelevant to this discussion.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Alright, I'm going to call you on this one. Are you purposely trying to create a circular argument?

Not at all. I just suggested a solution for his particular problem. What's wrong with that.

The problem is that most user who desire that simple functionality have to write own function or search the forum for a solution, often writing own function is faster, so we end up with many function doing same simple stuff.

AutoHotkey should be able to do things like this on its own because it is so simple to implement.
Imagine {Tab 3} would not be possible, would you then also suggest to write own function for that to expand {Tab 3} to {Tab}{Tab}{Tab}?

{100ms} would a better solution than {100}.

I agree.

I have got scripts that would be 2 pages long if there was not that feature,

May we see an example? It might help to demonstrate the need for this feature.

This would be worthless since we could use a function as Guest suggested.

  • Guests
  • Last active:
  • Joined: --

... because it is so simple to implement.

The process of designing syntax in a methodical manner is not simple and way harder than implementing the functionality with a non-organised design.

OK, I got one idea. What about allowing the expression mode and all numerical values in expression are regarded as delay.
SendInput, % "a" 1000 "{Enter}" 200 "b"

Imagine {Tab 3} would not be possible, would you then also suggest to write own function for that to expand {Tab 3} to {Tab}{Tab}{Tab}?

It would not be possible to expand it if the functionality of {Key n} did not exist.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

OK, I got one idea. What about allowing the expression mode and all numerical values in expression are regarded as delay.

SendInput, % "a" 1000 "{Enter}" 200 "b"

Expression mode is already allowed + this will send a number + this is not possible in current ahk design + we would break compatibility :!:

Imagine {Tab 3} would not be possible, would you then also suggest to write own function for that to expand {Tab 3} to {Tab}{Tab}{Tab}?

It would not be possible to expand it if the functionality of {Key n} did not exist.

If there was no {Tab 2}, we would write a function that would replace it with {Tab}{Tab}:!:

jaco0646
  • Moderators
  • 3165 posts
  • Last active: Apr 01 2014 01:46 AM
  • Joined: 07 Oct 2006

so we end up with many function doing same simple stuff.

I will try a different tack: will someone list a sample of threads creating, or asking for, these functions? Seeing their prevalence might help to demonstrate the need for this feature.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
I have over 30 small functions adding tiny functionality that I've never posted because they are too small...

Philister
  • Members
  • 57 posts
  • Last active: Sep 27 2016 08:10 PM
  • Joined: 12 Feb 2012
PowerPro has had this feature for ages without any problems. It uses this syntax:

{wn} - Wait n tenths of a second (eg {w1} to wait one tenth of a second)


Notice that there is no space following the 'w'. People use it all the time - just search the forum for {w1}, {w2} etc., you'll find hundreds of posts: http://tech.groups.y...r-pro/messages/

I'm sure something similar could be implemented in AHK without breaking old scripts. Maybe use {sXXX} so that
Send, Alpha{s501}Omega
waits 501 ms between sending 'Alpha' and 'Omega'.

Please, please, please implement this feature!

Thanks.

  • Guests
  • Last active:
  • Joined: --

Send, Alpha{s501}Omega

That might actually work, it won't break backwards compatibility as in my little test just now {s501} is simply ignored e.g. nothing is sent. Not saying it should be implemented, but if it is this would be the way to do it I think.

Scratch
  • Members
  • 108 posts
  • Last active: Mar 16 2014 08:02 PM
  • Joined: 22 Jan 2009
seems fair enough to me, doesnt break and for the reader distinguishable that its not like send {s 501} times, if the developers could be convinced of its
use then this seems like a rather fail safe way to implement

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
We should probably collect suggestions and do a poll to find out what majority of users thinks.

My vote goes definitely to number in {} brackets (that is what I have implemented in AHK_H).
{0} to {9} = send the digits as usual
{any digit higher 9} = sleep

It is very logical in my view and also does not break any scripts.
Also a sleep less than 16ms is not possible anyway.
Send, Alpha{501}Omega


Scratch
  • Members
  • 108 posts
  • Last active: Mar 16 2014 08:02 PM
  • Joined: 22 Jan 2009
Hotkeyit, i like that you are willing to expand the send, command, the convenience/cornerstone of AHK revolves imo about Hotkeys
so, while you are it, sometimes it bothers me that the send command triggers other hotkeys ie:
::ty:: Thank You
return

a:: send Hello
return

o:: send World
return
Typing in ty creates a rather nasty loop

So normally we would specifically have to turn off the looping key in advance:
Hotkey a, off
Hotkey o off
and turn them back on/off (tedious) one at the time, it would be nice if instead you have a overruling option between brackets to say that the following text must be send literal as is (notifies ahk to temporarily deactivate the correspondinng hotkeys found in the send string and reactivate the hotkeys after the literal text is send.

For example using quotes
::ty::{"Thank You"}

a:: send {"Hello"}
return

o:: send {"World"}
return

or if a variable is used and we dont know in advance if the variable may contain keycombo to trigger other hotkeys
for example if supplied by user:
send {%userinput%}
or
a= !
b = x
c = %a%%b%
send {%c%}   ; the % between the brackets will notify ahk not only its a variable but also to turn of hotkeys that the string might contain
return

!x :: Exitapp ; will not be activated by sending %c%

thoughts?

  • Guests
  • Last active:
  • Joined: --
Just use the standard available options
::ty:: Thank You

return ; you don't need this actually for one liners



[color=#BF0000]$[/color]a:: send Hello

return ; you don't need this actually



[color=#BF0000]$[/color]o:: send World

return ; you don't need this actually


engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
Guest is correct here. Some users may want the triggering of other keys. This is by design. The $ modifier tells the hotkey to (among other things) ignore simulated input.

</hijack>