I know it is polite to do a search first... but I'm asking first.
If you can find a thread about this or that's generally useful, point me to it.
I'd like to just ask my question, because I'm a bit new to the terminology, so although I'll be searching for an answer in the meantime, maybe you can tell me what it is that I'm looking for.
I spent some time review AHK's material about the sleep command, but some of the significance is lost on me. I did understand some of it though. (I'm new to coding-- been trying to wrap my head around Python for about 3 months now, working just a little bit each week.)
I've been attempting to write a command that would:
1. Open a drop down menu (in a cell) in an Excel spreadsheet
2. Cycle down 3 times
3. Then select that option.
I think the problem is that I need a delay after the initial command, and then several more, but perhaps I am not understanding the sleep command very well.
This is what I've got so far:
_____________________________________________________________________________________________________________________________________
^0::
Send, {Alt Down}
((Sleep command of some kind: I've tried half a dozen things and none of them have worked))
Send, {Down}
Send, {Down}
Send, {Down}
return
_____________________________________________________________________________________________________________________________________
Running: Windows 10, Microsoft Excel, AHK v1.1.28.02 - April 7, 2018
I'm not sure if I'm understanding the sleep command correctly
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: I'm not sure if I'm understanding the sleep command correctly
sleep, 1000
sleeps for 1 second
sleeps for 1 second
-
- Posts: 77
- Joined: 08 Aug 2015, 10:22
Re: I'm not sure if I'm understanding the sleep command correctly
I am by no means an expert, but what I think you're doing here is just opening and closing the cell-dropdown in Excel:
{Alt Down} simply means hold down the Alt-Key. So all you seem to be doing is holding down the Alt-Key and toggling the dropdown ON and Off with your separate {Down} sends.
What you may want to try is something like this:
However, I tested this (successfully) with a really old version of Excel. The triggering of Cell-DropDowns may have changed in newer versions.
{Alt Down} simply means hold down the Alt-Key. So all you seem to be doing is holding down the Alt-Key and toggling the dropdown ON and Off with your separate {Down} sends.
What you may want to try is something like this:
Code: Select all
^0::
send, {Alt Down}{Down} ;open the DropDown,
sleep, 300 ;wait a bit for the DropDown to open for sure
send, {Alt Up} ;now release the Alt-key
send, {Down 3} ;select the 3rd entry down the list
send, {Return} ;actually pick the 3rd entry
return
Who is online
Users browsing this forum: Google [Bot], Rohwedder and 174 guests