Windows AutoHotKey Communication Opener Tutorial

Windows AutoHotKey Communication Opener Tutorial

Windows AutoHotKey Communication Opener Tutorial

We wanted to work on the AutoHotKey scripting of yesterday’s Windows AutoHotKey Mail Opener Tutorial in a few functionality improvements …

  • set up to be #SingleInstance to make it that one Hot Key call equals one AutoHotKey program execution …
  • be able to create a temporary file maintenance (via Ctrl+Alt+n) via call of Notepad to be able to edit a user defined email body content, optionally …
  • that Notepad content be read and if first record integer content only … understand it as …
  • SMS, rather than email … but, alas, the sms:[SMSnumber]&body=[BodyContent] (URL) only worked on this Windows 10 with Microsoft Messenger just to open that app but not fill in either of [SMSnumber] nor [BodyContent] … but who’s to say is doesn’t work for your Windows setup?!

Here’s the changed AutoHotKey script called StartMail.ahk that achieves this progress, once compiled that is


#SingleInstance

^!n::
FormatTime timestamp, A_Now, yyyyMMdd
IfWinExist Untitled - Notepad
WinActivate
else
Run, Notepad "%TEMP%\bodyidea_%timestamp%.txt"
return

^!g::
VerbVar := "mailto:rmetcalfe15@gmail.com?subject=Which Old Thing..."
FormatTime timestamp, A_Now, yyyyMMdd
Ale := "%0A"
GetArg := "&"
ZeroOne := 0
HBodyVar =
BodyVar =
ifExist, %TEMP%\bodyidea_%timestamp%.txt
FileReadLine, HBodyVar, %TEMP%\bodyidea_%timestamp%.txt, 1
if HBodyVar is integer
{
VerbVar = sms:%HBodyVar%
ZeroOne := "1"
GetArg := "&"
}

Loop, read, %TEMP%\bodyidea_%timestamp%.txt
{
IfEqual, ZeroOne, 0
{
BodyVar = %BodyVar%%A_Space%%Ale%%A_LoopReadLine%
}

ZeroOne := 0
}

IfWinExist Mail
WinActivate
else
Run, "%VerbVar%%GetArg%body=%BodyVar%"
return

^!r::
VerbVar := "mailto:rmetcalfe@rjmprogramming.com.au.com?subject=That Old Thing..."
FormatTime timestamp, A_Now, yyyyMMdd
Ale := "%0A"
GetArg := "&"
ZeroOne := 0
HBodyVar =
BodyVar =
ifExist, %TEMP%\bodyidea_%timestamp%.txt
FileReadLine, HBodyVar, %TEMP%\bodyidea_%timestamp%.txt, 1
if HBodyVar is integer
{
VerbVar = sms:%HBodyVar%
ZeroOne := "1"
GetArg := "&"
}

Loop, read, %TEMP%\bodyidea_%timestamp%.txt
{
IfEqual, ZeroOne, 0
{
BodyVar = %BodyVar%%A_Space%%Ale%%A_LoopReadLine%
}

ZeroOne := 0
}

IfWinExist Mail
WinActivate
else
Run, "%VerbVar%%GetArg%body=%BodyVar%"
return

We hope you try this out!


Previous relevant Windows AutoHotKey Mail Opener Tutorial is shown below.

Windows AutoHotKey Mail Opener Tutorial

Windows AutoHotKey Mail Opener Tutorial

Just as you can revisit web applications, you might often revisit whole concepts, because as the years and software versions change, so might these whole concepts. Today’s case in point is a great Windows tool for programmers called AutoHotKey we’ve talked a lot about at this blog

AutoHotkey is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts for all kinds of tasks such as: form fillers, auto-clicking, macros, etc.

Are you always in the “online woooorrrllldd” or are you on Windows and still find desktop jobs you want to automate? If you are in the latter category, AutoHotKey could be your way to associate your own Hot Key combinations with whole sequences of a task, or just the starting bits, as with our entry level opening of Windows Mail with a To emailee and subject associated in the one AutoHotKey compiled *.exe for two Hot Key creations via the AutoHotKey script we’ve called StartMail.ahk


^!g::
IfWinExist Mail
WinActivate
else
Run, "mailto:rmetcalfe15@gmail.com?subject=Which Old Thing..."
return

^!r::
IfWinExist Mail
WinActivate
else
Run, "mailto:rmetcalfe@rjmprogramming.com.au?subject=That Old Thing..."
return

… the Hot Key associated with today’s tutorial picture being Ctrl+Alt+g (ie. that first, of two, Hot Key definitions in the AutoHotKey script above, whereas the second could be executed via Ctrl+Alt+r).

This, to me, is like “looking under the hood” of Windows, especially if you start up AutoHotKey’s excellent “Window Spy” tool (that can help you glean a focussed window of interest’s details that you might be interested in). Can you believe in years gone past you used to be able to Record your actions, though that is not offered free anymore, or not feasible anymore (the latter a reason that would not surprise us … but a little hard graft … “bliss” … I can hear you say?!)? These Windows *.exe you can create via AutoHotKey used to be a less security restricted idea, but AutoHotKey can help you quickly realize that joy creating desktop programs can give you.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>