autohotkey help

Hello,

I am new to using autothotkey and I love it so far for my signatures, but I am unable to write a script that, while composing an email in thunderbird will:
- reformat all text on the page to an Arial font
- and return the cursor to the top of the page

I am able to write a script that will
- Change all text to Arial

and I am able to write a script that will
- Change all text to Times New Roman
- and return the cursor to the top of the page,

but when I write a script to
- Change all text to Arial
- and return the cursor to the top of the page
here is what happens:
As soon as I add the home and page up commands, the script fails to change the font to Arial and changes the font to Times New Roman instead.  

Here are the test scripts that I am using and my results:

1. This script successfully reformats all the text on the page to Arial

!a::
Send ^a
; Selects all text on page
Send ^+y;
; Discontinues all text styles
Send ^a
; Selects all text on page
Send !ofl
; Top Menu > Format > Arial
return

2. This script successfully reformats all the text on the page to Times New Roman
AND returns the cursor to the top of the page

!a::
Send ^a
; Selects all text on page
Send ^+y
; Discontinues all text styles
Send ^a
; Selects all text on page
Send !oft
; Top Menu > Format > Times New Roman
Send {PgUp 3}{Home}
; Returns cursor to the top of the page
return

3. This script is supposed to reformat all of the text on the page to Arial and return the cursor to the top of the page, but although the font type drop down menu does change to Arial, the text on the page gets changed to Times New Roman instead of Arial.   .

!a::
Send ^a
; Selects all text on page
Send ^+y
; Discontinues all text styles
Send ^a
; Selects all text on page
Send !ofl
; Top Menu > Format > Arial
Send {PgUp 3}{Home}
; Returns cursor to the top of the page
return

If you use thunderbird and autohotkey, please check these scripts for me and let me know what you suggest.  

Thanks for your help!

Shawn
Shawn-in-VAAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
matrixnzConnect With a Mentor Commented:
Change
Send !ofl
; Top Menu > Format > Arial
Send {PgUp 3}{Home}

To

Send !ofl
; Top Menu > Format > Arial
Sleep(1000)
Send ^{Home}

For some reason it needs time to release the "Alt" so basically previously it was still on the "Top Menu > Format > Arial" pressing page up just moved the cursor to the top of this list.  Are you sure the Time New Roman actually change changed the name to Time New Roman or did it select Variable Width, which is the top of the Font List, this also leaves the change as Times New Roman.

Hopefully this made sense.

Cheers
0
 
Shawn-in-VAAuthor Commented:
Thanks for your help!    I had to change it to this to get it to work, but your help with the sleep command worked like a charm.

!a:: ; CHANGE TO ARIAL
Send ^a ; SelectAll
Send ^+y ; Discontinue Text Styles
Send ^a ; SelectAll
Sleep, 500 ; delay
Send !ofl ; Top Menu > Format > Arial
Sleep, 500 ; delay
Send ^{Home} ; Return to top of page
return
0
 
matrixnzCommented:
Glad to help

Sorry about the context, I use AutoIT the mother of AutoHotKeys (so to speak) so the commands are slightly different.  However it was strange that it didn't work the same as AutoIT, but either way glad you found a work around.

Cheers
0
All Courses

From novice to tech pro — start learning today.