terraterm Posted October 29, 2013 Share Posted October 29, 2013 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) Link to comment Share on other sites More sharing options...
abberration Posted October 29, 2013 Share Posted October 29, 2013 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 Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
RyanC Posted October 30, 2013 Share Posted October 30, 2013 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 Link to comment Share on other sites More sharing options...
terraterm Posted October 30, 2013 Author Share Posted October 30, 2013 more experimenting todo and i thought this would be simple Link to comment Share on other sites More sharing options...
Jfish Posted October 30, 2013 Share Posted October 30, 2013 (edited) 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 October 31, 2013 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 31, 2013 Moderators Share Posted October 31, 2013 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
terraterm Posted October 31, 2013 Author Share Posted October 31, 2013 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 will do Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now