AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Send, {Sleep 1000}

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  

Include in AutoHotkey documentation?
YES
50%
 50%  [ 2 ]
NO
50%
 50%  [ 2 ]
Total Votes : 4

Author Message
HotKeyIt



Joined: 18 Jun 2008
Posts: 230
Location: GERMANY

PostPosted: Thu Aug 28, 2008 8:07 am    Post subject: Send, {Sleep 1000} Reply with quote

I have found an undocumented feature which I actually wanted to add to wish list, but it seems it is working little different.

You can add a Sleep into your Send command.

For Example:
Send, +{F6}{Sleep 100}abc{Sleep 100}{ENTER}

How ever, when you try following, you will notice it sleeps longer, not sure why:
Code:

A_Start := A_TickCount
Send, {Sleep 1000}
MsgBox % A_TickCount - A_Start " miliseconds elapsed."


It takes for me around 15625 milliseconds instead 1000.
This would mean a millisecond entered here takes around 15.6 milliseconds.
[Edit] Send, {Sleep 60} works for me like Sleep, 1000.

Should Sleep be working properly in a Send?

Any way, this may save many lines of code if you need Sleep between sending keys. I think it should be documented in AHK help.
_________________
AutoHotFile


Last edited by HotKeyIt on Thu Aug 28, 2008 9:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
Slanter



Joined: 28 May 2008
Posts: 397
Location: Minnesota, USA

PostPosted: Thu Aug 28, 2008 8:49 am    Post subject: Reply with quote

This isn't using the sleep command, you're repeatedly sending the computer's SLEEP key. It's documented Here (Search for {Sleep} on the page)

More on the Sleep Key
_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 230
Location: GERMANY

PostPosted: Thu Aug 28, 2008 9:45 am    Post subject: Reply with quote

Thanks for explanation Slanter, it is still very usable as it saves a lot of code and lines.

Shouldn't computer actually go into sleep mode?

I think this can be really used similar to sleep command.

For me {Sleep 6} takes nearly 100 ms so if I need 1 second 60, ten seconds 600 and so on. Looks like it is also not consuming much of cpu.

The only disadvantage is that modifier keys are not working while sleep key is being pressed in Send mode.

Looks like it is 15 ms for one press because of SetKeyDelay, 1 standard.

NOTE: when using other Send modes like SendInput you will get various results.


I think still this should be documented in AutoHotkey documentation as it helps a lot.
Especially If the sleep key will definitely not send computer to sleep. I tried till now on 2 computers but both do not have the key on the keyboard, so not sure how it would be if there is a key Sleep.
_________________
AutoHotFile
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Aug 28, 2008 2:38 pm    Post subject: Re: Send, {Sleep 1000} Reply with quote

HotKeyIt wrote:
...which I actually wanted to add to wish list...

...beat ya...

JSLover wrote:
...Chris...is there anyway to Sleep inside a Send command?

Super related, my Send() function, currently only mentioned here...(in reply to someone else's function)...
...is parses the Send line & replaces any {Sleep X} with a real Sleep...
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 230
Location: GERMANY

PostPosted: Thu Aug 28, 2008 5:50 pm    Post subject: Reply with quote

unexis03 wrote:
SendInputSlow() - Delay Function



Thanks for this, for me it looks easier to use easily {Sleep 60} (pressing sleep key 60 times = around 1 second) even I will not be able to use SendInput (in this case will surely use your script.)

As far as I understand Sleep key is to send computer to sleep (I have only a FN + F4) and when I use Sleep key in a Send command, it does not do anything and send command sleeps.

Any Ideas?
Is they key only working when it is existing on keyboard?
Is the key possibly disabled somehow and if, where?
_________________
AutoHotFile
Back to top
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 1145
Location: The Interwebs

PostPosted: Thu Aug 28, 2008 7:14 pm    Post subject: Reply with quote

HotKeyIt wrote:

I think still this should be documented in AutoHotkey documentation as it helps a lot.

It is documented. Slanter even posted a link to where the documentation is.

HotKeyIt wrote:
unexis03 wrote:
SendInputSlow() - Delay Function



Thanks for this, for me it looks easier to use easily {Sleep 60} (pressing sleep key 60 times = around 1 second) even I will not be able to use SendInput (in this case will surely use your script.)

As far as I understand Sleep key is to send computer to sleep (I have only a FN + F4) and when I use Sleep key in a Send command, it does not do anything and send command sleeps.

Any Ideas?
Is they key only working when it is existing on keyboard?
Is the key possibly disabled somehow and if, where?


It is probably because you continue to send keystrokes after the sleep command, which should wake the computer up, I believe. Try sending it alone and then not pressing anything else on your keyboard/mouse.
_________________
PlayAHK! Try it out Very Happy
Back to top
View user's profile Send private message AIM Address
HotKeyIt



Joined: 18 Jun 2008
Posts: 230
Location: GERMANY

PostPosted: Thu Aug 28, 2008 9:37 pm    Post subject: Reply with quote

Krogdor wrote:
It is probably because you continue to send keystrokes after the sleep command, which should wake the computer up, I believe. Try sending it alone and then not pressing anything else on your keyboard/mouse.


I have tried, nothing happens, what happens for you? Does you computer go to sleep mode?
_________________
AutoHotFile
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Aug 28, 2008 9:47 pm    Post subject: Reply with quote

HotKeyIt wrote:
unexis03 wrote:
SendInputSlow() - Delay Function

...yes unexis03 wrote the SendInputSlow() function, but I meant MY Send() function!...

Code:
sendthis=Hello{Sleep, 1000}There
Send(sendthis)

...my function is better than his & works exactly like you are trying to use the Send command...

HotKeyIt wrote:
...even I will not be able to use SendInput (in this case will surely use your script.)

...MY script/Send() function...supports Send, SendInput, SendPlay & my own creation, Send Fast...

The Computer Sleep function requires your computer to support it...plus it can be disabled in Control Panel...
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 230
Location: GERMANY

PostPosted: Thu Aug 28, 2008 10:26 pm    Post subject: Reply with quote

Where is actually the option to disable it, I cannot find in control panel and in bios neither.
_________________
AutoHotFile
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1496

PostPosted: Thu Aug 28, 2008 11:01 pm    Post subject: Reply with quote

HotKeyIt wrote:
Where is actually the option to disable it, I cannot find in control panel and in bios neither.

[Display Properies]->[Screensaver]->(Power)->[Advanced]->"When I press the sleep button on my computer..."
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 230
Location: GERMANY

PostPosted: Thu Aug 28, 2008 11:21 pm    Post subject: Reply with quote

This is set up on my laptop and is run pressing Fn + F4.
Still Send, {Sleep} does not get my laptop to go sleep.
_________________
AutoHotFile
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 230
Location: GERMANY

PostPosted: Fri Oct 03, 2008 8:23 am    Post subject: Reply with quote

Any one else who could test that???

Till now I could use that as a sleep very well???

I have also a keyboard and it has a sleep button but Send, {Sleep} does not get my computer to sleep?

Please can anybody do some tests and confirm:
Code:
Send, {Sleep}

_________________
AutoHotFile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group