Author Topic: AutoHotkey  (Read 6327 times)

Pommy Stuart

  • Shipherd
  • Hero Member
  • *****
  • Posts: 3405
  • A closed mouth gathers no foot.
    • View Profile
Re: AutoHotkey
« Reply #15 on: December 05, 2015, 02:58:13 am »
Mine includes:

f2::
    Send, Hour{enter}Wind Direction{enter}Wind Force{enter}Barometer Height{enter}Temp Air Dry{enter}Temp Air Wet{enter}Temp Water{enter}Weather{enter}Forms of Clouds{enter}Prop of clear Sky
Return


Randi, Where/when do you use the f2 auto hot key script?

::bw::begins with
If you type "bw " (you don't need the quotes, but you do need the space), you get begins with.
If you type "Bw " you get Begins with.

Randi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 12054
    • View Profile
Re: AutoHotkey
« Reply #16 on: December 05, 2015, 07:28:27 am »
I use that when entering the headings in OW5 (the new Old Weather).

jil

  • Editor
  • Hero Member
  • *****
  • Posts: 2586
    • View Profile
Re: AutoHotkey
« Reply #17 on: December 05, 2015, 09:30:26 am »
Thanks Randi, that's saved me having to work that one out!

Randi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 12054
    • View Profile
Re: AutoHotkey
« Reply #18 on: December 05, 2015, 12:10:52 pm »
P.S.

If I type one double quote (") and then hit enter, I get the quote. However, when I have several in a row, I do not always get the quote. The following works reliably for me:

Quote
\::
   Send, "{Space}{Enter}
Return

Hanabal94 has a different system, but it doesn't work for me.

AvastMH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7043
    • View Profile
Re: AutoHotkey
« Reply #19 on: December 05, 2015, 12:52:52 pm »
Ok- I've sorted out the file and made a new file with an ahk extension on it, and got a notepad file for all that work, typed in this:

::Widir::Wind direction
::wifor::Wind Force
::hii::Barometer Height in inches
::adb::Temperature Air Dry Bulb
::awb::Temperature Air Wet Bulb
::aws::Temperature Water at Surface
::wbs::Weather by symbols
::cloudsf::Clouds Form
::cloudsam::Clouds Amount
::Vby::Visibility
::vbl::Variable

what do I do now please? I saved it and closed it and tried just typing in ' Wind direction' in the relevant box on OW - but nothing exciting happened  :-\

Randi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 12054
    • View Profile
Re: AutoHotkey
« Reply #20 on: December 05, 2015, 01:03:13 pm »
You do have to have AHK "running". You should see a little H icon on your task bar with the other little symbols NOT with the programs.

You should have the AHK icon on your desktop. You can start it from there. 

I strongly suggest that you do your testing in Notepad or a PM rather that in the transcribing interface ;)



Don't forget that you need to type a space after those commands to get them to expand.

f2 (the function key F2) is a slightly different command format. There you do not need to type a space. With f2 you can do all the headers in one go.
« Last Edit: December 05, 2015, 01:15:33 pm by Randi »

AvastMH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7043
    • View Profile
Re: AutoHotkey
« Reply #21 on: December 05, 2015, 02:37:33 pm »
wonderful -thanks randi. - see what you mean about testing it out elsewhere - and I'm getting quite bored quick at typing the headings anyway  ;)

Whoa! Did it!!!!!! Yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah!!!  ;D

thanks randi, thanks all.  :D

(evidence: Wind direction hehehe  ;D)
« Last Edit: December 05, 2015, 02:40:01 pm by AvastMH »

Randi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 12054
    • View Profile
Re: AutoHotkey
« Reply #22 on: December 05, 2015, 04:13:47 pm »
Joan - for the header, try:

f3::
    Send, Hour{enter}Wind direction{enter}Wind Force{enter}Barometer Height in inches{enter}Temperature Air Dry Bulb{enter}Temperature Air Wet Bulb{enter}Temperature Water at Surface{enter}Weather by symbols{enter}Clouds Form{enter}Clouds Amount{enter}Visibility{enter}Sea Condition{enter}Sea Swells From
Return


gives me:

Hour
Wind direction
Wind Force
Barometer Height in inches
Temperature Air Dry Bulb
Temperature Air Wet Bulb
Temperature Water at Surface
Weather by symbols
Clouds Form
Clouds Amount
Visibility
Sea Condition
Sea Swells From

with one key press



OK, Joan - Here is the updated version ;)
« Last Edit: December 05, 2015, 09:55:48 pm by Randi »

mapurves

  • Shipherd
  • Hero Member
  • *****
  • Posts: 1815
    • View Profile
Re: AutoHotkey
« Reply #23 on: March 18, 2016, 04:08:19 pm »
   I was prompted, finally, to start using hotkeys. I had sent AvastMH a strategy for dealing with faint pages, and I noted that it took eight keystrokes for each page. I also said that it would be quite easy to put it into AutoHotKey. So, feeling like an unredeemed luddite, I downloaded AutoHotKey, learned how to use it and I automated my eight keystrokes.

   Then, two days ago, not wanting to start another day because I was waiting for a call from my Officer Commanding to pick her up from work, I wondered if I could automate the drawing of the weather boxes in Classic Old Weather. (I don't like moving from keyboard to mouse and back, and I find it takes a bit of time.)

   You have to draw the first weather box, and then you leave your cursor in the spot for the next box, but two rows down, not one (see the red cursor in the image below). When you have entered the cloud amount, you enter Ctrl-2 for an even hour row, or Ctrl-1 for an odd numbered row. The reason for the "extra" row was so that the cursor would be clear of your weather boxes when you were entering the data.


Here is the image showing where to place your cursor to get started:



Here is a shot of your boxes at the end of the day:



If you don't care for the staggered box effect, change the 19 to zero and have just one function. The values for the mouse moves will be particular for my screen. For me, a row is 16 pixels high and the wind speed box is 19 pixels wide. It took me a few adjustments to get it perfectly lined up.

Also, it took me about three days to retrain old habits and not touch the mouse, except to move down to the PM observations. If you do move your mouse, you just need to start the next box normally and go back tot he hotkey method. From the few days of ship time I've had, it does seem much faster. A weather entry would go like:

1 tab NNE tab 1 tab 29.94 tab 83 tab 81 tab 75 tab tab bc tab Cum tab 7 Ctrl-2 and you then enter the next hour 2.
« Last Edit: May 04, 2016, 05:19:29 pm by mapurves »

Randi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 12054
    • View Profile
Re: AutoHotkey
« Reply #24 on: March 18, 2016, 04:43:03 pm »


Very impressive.
I don't know if I could keep up with it...

Craig

  • Shipherd
  • Hero Member
  • *****
  • Posts: 2970
    • View Profile
Re: AutoHotkey
« Reply #25 on: March 18, 2016, 05:51:14 pm »
Very good, Michael. You're right that moving your hand from the numpad to the mouse and back slows one down. I find I also waste time trying to click as close as possible to the box above without touching it and end up having to move and click again. I guess you have to be careful to not to make your first box too big or else they will gradually get out of alignment with the rows?

On second thought, since you always move the cursor the same amount you won't get out of alignment. But if you make the first box too big won't you have the same overlap problem as I do?
« Last Edit: March 18, 2016, 06:07:14 pm by Craig »

mapurves

  • Shipherd
  • Hero Member
  • *****
  • Posts: 1815
    • View Profile
Re: AutoHotkey
« Reply #26 on: March 18, 2016, 06:24:55 pm »
Very good, Michael. You're right that moving your hand from the numpad to the mouse and back slows one down. I find I also waste time trying to click as close as possible to the box above without touching it and end up having to move and click again. I guess you have to be careful to not to make your first box too big or else they will gradually get out of alignment with the rows?

On second thought, since you always move the cursor the same amount you won't get out of alignment. But if you make the first box too big won't you have the same overlap problem as I do?

No the size of the box doesn't matter, as long as it doesn't completely cover two rows, which it wouldn't. The next box is drawn based on the position of where the cursor was left, which is two rows below the current data box (one row below the point you would normally place it). Even if you draw your first box so it is somewhat below the horizontal line, as long as you leave your cursor at the point two rows down, you're OK.

Also, I found it troubling to remember whether I should be using Ctrl-1 or Ctrl-2 for even and odd, and I realized I could just input the number as well, so Ctrl-2 will draw the box and enter 2 in the hour box and tab to the wind. Ctrl-3 will draw the box, enter 3 and tab to the wind, and so on. It is much easier. I use Ctrl-0 for 10, Ctrl-e for Eleven and Ctrl-w for 12. Even if you forget and press Enter when you've done the sky/cloud amount, entering the proper Ctrl sequence will get the next box in the right place, as long as you don't move the cursor. If you do move the cursor, just place it in the proper place, one row down from where you would normally place it, and press the Ctrl sequence.

The tricky part is to un-learn the habits after so many years of drawing boxes. It took me a a few pages to be really comfortable. Now it is amazingly gratifying and quick, especially having a control sequence for each hour. (I really didn't like drawing boxes.)  ;)

If you don't want the staggered boxes, change 19 and -19 to zero. The 16 and 32 will depend on screen size, I imagine, but maybe not. The second value (32) must be double that of the first.

Just replace the Ctrl-1 and Ctrl-2 functions with these and you'll be set. I leave it as an exercise for the people in OW4 or OW5 to use this technique to draw their boxes...  ;D

« Last Edit: May 04, 2016, 05:20:28 pm by mapurves »

AvastMH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7043
    • View Profile
Re: AutoHotkey
« Reply #27 on: March 18, 2016, 06:28:53 pm »
awesome awesome awesome  :o :o :o
Can I now crawl back under my IT prehistoric stone to let my brain cool down before engaging in reading it again?  ;) ;) ;D

Randi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 12054
    • View Profile
Re: AutoHotkey
« Reply #28 on: March 18, 2016, 06:35:18 pm »
Can I keep you company, Joan? ;D

Michael, that is truly awesome! I will give it a try when I get my courage up :-[

AvastMH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7043
    • View Profile
Re: AutoHotkey
« Reply #29 on: March 18, 2016, 07:17:24 pm »
It's a big stone..crawl under...it's lonely here just now... ;) ;) ;D