Jump to content
Sign in to follow this  
terraterm

Newbie

Recommended Posts

terraterm

hi

I want to create a simple script to do the following, but i'm lost.

The Script

highlight & copy any text from a webpage (anything copied from the webpage is instanley copied to the clipboard. (autocopy addon, firefox)

paste the text into word

close and save the document to the specified directory

open a new document(ready for the next sequence)

Share this post


Link to post
Share on other sites
abberration

Here's a crude example that saves what you copy to a text file. There are probably better ways of doing this, but this is the easiest I could think of. There are Word functions in AutoIt, but I'm just trying to give one idea of how it could be done. This one will work 4 times that you copy text and then close out.

ShellExecute("www.autoitscript.com")
$i = 0
$currentClipboard = ClipGet()
Do
    $newClipboard = ClipGet()
    If $newClipboard <> $currentClipboard AND $newClipboard <> "" Then
        FileWrite(@ScriptDir & "\zfile" & $i & ".txt", $newClipboard)
        $currentClipboard = ClipGet()
        $i += 1
    EndIf
Until $i = 4

RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites
RyanC

Oh, holy ****! I was trying to manipulate the clipboard with some fancy function that was about six lines long (and failing)...

I do a search to see what's wrong, and find out the ENTIRE THING I WANT is done with "ClipPut($var)"....grrrr. Thanks for this thread, It cleaned up my code when the help file actually failed me.


Ryan

Recent AutoIT student and sudden fanatic

Share this post


Link to post
Share on other sites
terraterm

more experimenting todo and i thought this would be simple

Share this post


Link to post
Share on other sites
Jfish

Hello, there are several functions that may do the trick starting with the UDF for IE: _IEBodyReadText ( ByRef $o_object ).  That will read all the text between the body tags.  Then to place it into Word there is also a Word UDF.  I am not using the latest one but it does not seem to have a paste function so you could do this with the COM API to the object the UDF creates:

#include <Word.au3>
#include <IE.au3>
$oIE = _IE_Example ("basic") ; open AU3 web page example
$sText = _IEBodyReadText ($oIE) ; grab text from within body tags
ClipPut ( $sText) ; put the text to the clipboard
$myDoc=_WordCreate (@ScriptDir&"\mydoc.doc") ; create a word doc
$myDoc.ActiveDocument.ActiveWindow.Panes(1).Selection.Paste ;paste the text into the word doc

For FF try the FF UDF and

#Include <FF.au3>
_FFReadText([$iFilter = 0])
Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
Melba23

terraterm,

Welcome to the AutoIt forum. :)

But could you please use more descriptive thread titles in future - it makes it much easier to search through the forum later. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
terraterm

&nbsp;

terraterm,

Welcome to the AutoIt forum. :)

But could you please use more descriptive thread titles in future - it makes it much easier to search through the forum later. ;)

M23

&nbsp;

will do

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  

×