How to send formatted/rich data (formatted text, links, images, etc)

Helpful script writing tricks and HowTo's
list
Posts: 99
Joined: 26 Mar 2014, 14:03
Contact:

How to send formatted/rich data (formatted text, links, images, etc)

22 Jul 2015, 15:22

How to send formatted/rich data (formatted text, links, images, etc)

Using standard Hotstrings (expand abbreviations as you type them (auto-replace)) and Hotkeys combined with Send you can of course send regular text, but what about formatted text, bold, italics, tables, bullet lists, images, links?

This brief tutorial will describe the available methods to be able to do this, mostly linking to specific post with usable scripts.

Other suggestions welcome of course.

[ shameless self promotion ]
If this is all too much trouble, you can of course always install Lintalist - http://lintalist.github.io/ which can use HTML, Markdown, RTF and Images :-)
(Lintalist uses the WinClip() technique)
[/ shameless self promotion ]


1 - Send keystrokes such as ctrl-b or ctrl-i for bold and italics
2 - Copy & Paste
3 - How to paste an Image?
4 - Using WinClip()
5 - Using Office files

1 - Send keystrokes such as ctrl-b or ctrl-i for bold and italics

Code: [Select all] [Download] GeSHi © Codebox Plus

; be sure to try this is with an application where ctrl-b will start "bold",
; most office applications or email programs for example.
::test::We want to ^bthese words bold^b but also ^isome italics^i would be possible


2 - Copy & Paste

For this method you will need two scripts:

Script 1

Select some formatted text and/or image(s) in for example MS Word or your browser and press winkey-z, this will save the ClipboardAll variable to a file which you can later read back. You only have to do this once.

Code: [Select all] [Download] GeSHi © Codebox Plus

#z::
Send ^c ; copy selected text and images to the clipboard
FileAppend, %ClipboardAll%, CopiedData.clip
Return


Script 2

Now you can read back the formatted text and/or image(s) back into the clipboard by using the *c option of the FileRead command

Code: [Select all] [Download] GeSHi © Codebox Plus

#v::
FileRead, Clipboard, *c CopiedData.clip
Sleep 200 ; give the clipboard some time to receive the data
Send ^v ; paste the data we have just read from the file
Return


Tip: see the Clipboard documentation for a trick to store and restore the current clipboard contents

3 - How to paste an Image?

3a: Using GDI - viewtopic.php?p=17326#p17326
3b: Using irfanview - viewtopic.php?p=17326#p17326

4 - Using WinClip()

WinClip is a clipboard manipulation class which allow you to do a bit more than the common ahk clipboard can written by Deo:
http://www.autohotkey.com/board/topic/7 ... pulations/

4a: Working example HTML http://www.autohotkey.com/board/topic/7 ... ntry502253
4b: Working example RTF http://www.autohotkey.com/board/topic/7 ... ntry502267

5 - Using Office files

MS Word example http://www.autohotkey.com/board/topic/7 ... ntry494436

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 7 guests