Sign in to follow this  
Followers 0


2 posts in this topic

#1 ·  Posted (edited)


Okay, since I created the _ClipPutHyperlink() function, I figured I might as well just go one step further and open up the whole HTML Clipboard send/put interface and make it really simple to use - not only for simple Hyperlinks, but also for complete pieces of HTML code as well.

Note that 'PlainText' is the optional view of your HTML code that should be free of formatting. This is helpful when pasting to applications that don't accept HTML formatted strings, such as Notepad.

Note also that the HTML code NEEDS to be encoded in UTF-8 format. (For straight-ANSI/ASCII code, you don't need to do anything, UTF-8 encoding only comes into play for Unicode formatting).

Anyway, bundled in the ZIP is the UDF and a short example (same as the below HTMLPut Example).

Additionally, see the sample code for _ClipGetHTML().

Example 1: HyperlinkPut:

; Special Unicode text call
_ClipPutHyperlink("",ChrW(0x30B0)& ChrW(0x30FC)& ChrW(0x30B0)& ChrW(0x30EB)& " (Japanese Google)")
; Regular text

- Example 'paste' Output -

Unicode Hyperlink:

グーグル (Japanese Google)

Regular Hyperlink:


Example 2: HTMLPut

; Example is in 'Quote' because Code & AutoIt tags fail to handle this properly at the moment:

Local $sHTMLStr,$sPlainTextStr

$sHTMLStr='<html><head>'&@CRLF & " <title>Page Title</title>"&@CRLF & _

' <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'&@CRLF & _

"</head>"&@CRLF & "<body>"&@CRLF & "<h1>Headline Text</h1>"&@CRLF & _

"<p>This is a paragraph showing the formatting possibilities using the "&@CRLF & _

'<a href="">_ClipPutHTML() functions</a>.'&@CRLF& _

" The regular modifiders, such as <strong>bold</strong>, <i>italics</i>, and <u>underlines</u> work as usual,"&@CRLF& _

" just like all other HTML formatting.</p>"&@CRLF & "<p>Â </p>"&@CRLF & _

"<p><strong>Here's an example list:</strong></p>"&@CRLF & "<ul>"&@CRLF & _

" <li>List <i>item</i> #1.</li>"&@CRLF & _

" <li>List <i>item</i> #2.</li>"&@CRLF & _

' <li>List <i>item</i> #3 with a <a href="">Hyperlink</a></li>'&@CRLF & _

"</ul>"&@CRLF & "</body>"&@CRLF & "</html>"

$sPlainTextStr="Headline Text"&@CRLF&@CRLF& _

"This is a paragraph showing the formatting possibilities using the _ClipPutHTML() functions."& _

"The regular modifiders, such as bold, italics, and underlines work as usual, just like all other HTML formatting."&@CRLF&@CRLF& _

" Here's an example list:"&@CRLF& _

" * List item #1."&@CRLF& _

" * List item #2."&@CRLF& _

" * List item #3 with a Hyperlink"&@CRLF


- Example 'paste' output -

Headline Text

This is a paragraph showing the formatting possibilities using the _ClipPutHTML() functions. The regular modifiders, such as bold, italics, and underlines work as usual, just like all other HTML formatting.

Here's an example list:

  • List item #1.
  • List item #2.
  • List item #3 with a Hyperlink

Get the Code at my Site

Ascend4nt's AutoIT Code License agreement:

While I provide this source code freely, if you do use the code in your projects, all I ask is that:

  • If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I credit

  • If the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though again if the source is provided - see #1)

  • The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.

  • Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.
Edited by Ascend4nt

Share this post

Link to post
Share on other sites

#2 ·  Posted (edited)

.. Edited by Ascend4nt

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • Spask
      By Spask
      Hi, I'm trying to find a text value inside of a html.
      This is what the line looks like normally:
      <p id="line1" class> <span class="bot">TEXT HERE</span> </p> The text then changes to a non breaking space:
      <p id="line1" class> <span class="bot">&nbsp;</span> </p> And then it changes back to normal text but it's different every time.
      Can I code this so that it grabs the text every time it changes and has a variable that represents it?
      I currently have this inside of my loop:
      $span = .document.getElementsByTagName("span") For $text In $span If $text.value = "&nbsp;" Then Sleep(50) MsgBox(0,0,0) ;messagebox to test if it can be found, but I don't know how to grab the text EndIf Next The problem is that there are many other lines in the html that have the same span but are called "line3", "line5", etc and the one I need is from "line1".
      I will appreciate if anyone can help with this!
    • rudi
      By rudi
      I fail trying to save content from WhatsApp other then plain text to a file that way, that non-char-content will be preserved in it's correct encoding. e.g. Emojis are spoiled.
      I've tried to do so using just filewrite() as well as forcing UTF
      #include <clipboard.au3> MsgBox(0,"Ready to read clipboard","Mark some WhatsApp content with non-char elements, e.g. Emojis, copy that to your clipboard (CTRL+c), then click OK here.") $ClipContent=_ClipBoard_GetData() ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $ClipContent = ' & $ClipContent & @CRLF & '>Error code: ' & @error & @CRLF & "Extended: " & @extended & @CRLF) ;### Debug Console $File="C:\temp\ClipSaveToFile.txt" $h=FileOpen($File,2+8+64) ; overwrite, create path, UTF16 FileWrite($h,$ClipContent) FileClose($h) $h=FileOpen($File,64) $NeuGelesen=FileRead($h) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $NeuGelesen = ' & $NeuGelesen & @CRLF & '>Error code: ' & @error & @CRLF & StringLen ($NeuGelesen) & @CRLF ) ;### Debug Console FileClose($h) _ClipBoard_SetData($NeuGelesen) MsgBox(0,"Done","Re-read content of TEMP file was placed to the clipboard. Now paste this into WhatsApp. (Emojis will be spoiled)") I've also tried other encodings (16, 32, 64, 512)

      Or what is a different, functional approach to save WhatsApp Content to File in a way, to be able to to get it back to post it back to WhatsApp?

      Regards, Rudi.
    • AndreyS
      By AndreyS
      Hello to you, dear developers!
      Could you please tell me if there is an easy way to determine if the information was pasted from the clipboard?
      Without any variation of the insertion via Ctrl+V, or through the context menu.
      I revised the Help and many forum topics, but found nothing suitable.
      Can there be any WinAPI system events that determine this event?
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      Before all, I want to say that I'm doing this script to see how _IE* functions work, and see if my studs can hack a quiz I'm working on.
      I want to clarify that I'm not automating any game, bypassing any CAPTCHAs, or anything that could damage anyone.
      I was trying to autofill a form, based on which question is displayed.
      The question is always stored in here:
      <header> <h1><span class="questionid">1. </span>Here goes the question</h1> </header> And answers are stored in here:
      <ul class="answers"> <li><label><span><input id="answer_0" name="answer[]" type="radio" value="0">Answer 1</span></label></li> <li><label><span><input id="answer_1" name="answer[]" type="radio" value="1">Answer 2</span></label></li> <li><label><span><input id="answer_2" name="answer[]" type="radio" value="2">Anwser 3</span></label></li> <li><label><span><input id="answer_3" name="answer[]" type="radio" value="3">Answer 4</span></label></li> </ul></fieldset></form></div> And, there are 15 questions like this.
      How can automatically fill my form?
      Thanks in advance
    • houser747
      By houser747
      I have previously used _IEFormElementGetObjByName and _IEFormElementSetValue to enter text into a search box on a form and then submit the form.
      I am now trying to enter text into a search box which is not part of a form. 
      Here is the HTML from the website that i'm trying to enter the data on and then submit the search.
      <div class="row">
          <div class="form-group col-xs-12">
              <span id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_lblSearchText" for="input-search">Registreringsbeteckning</span>
              <div class="input-group col-xs-12">
                  <span id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_preSearchText" class="input-group-addon">SE -</span>
                  <input name="ctl00$FullWidthWithSubmenuContent$FullWidthContent$MainContent$AircraftRegistry$txtSearchText" type="text" value="DTH" id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_txtSearchText" class="form-control" />
      <div class="row">
          <div class="form-group col-xs-12">
              <label class="sr-only" for="">Sök</label>
              <input type="submit" name="ctl00$FullWidthWithSubmenuContent$FullWidthContent$MainContent$AircraftRegistry$btnSearch" value="Sök" id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_btnSearch" class="btn btn-primary ladda-button" data-style="expand-right" />
      Many thanks in advance