Link to home
Start Free TrialLog in
Avatar of Shawn-in-VA
Shawn-in-VA

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of matrixnz
matrixnz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shawn-in-VA
Shawn-in-VA

ASKER

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
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