Joegio13 Posted December 6, 2006 Share Posted December 6, 2006 I wanna transfer text that is placed into the clipboard into a variable. then be able to send it from the variable back to notepad or some other word processor. i currently am using something of the sort: WinActivate("First Program") WinWaitActive("First Program") ; Go to beginning of field Send("{HOME}") ; Select all data in field and copy selected text Send("{CTRLDOWN}a{CTRLUP}") Send("{CTRLDOWN}c{CTRLUP}") ; Switch to Notepad WinActivate("Untitled - Notepad") WinWaitActive("Untitled - Notepad") ; Paste copied text Send("{CTRLDOWN}v{CTRLUP}") ; Press End, insert a comma & press Enter send("{END},{ENTER}") what i wanna do is that when i copy the data into the clipboard that instead of switching into notepad i get the data placed into a variable. that way i can capture all the fields and then go to notepad and just paste all data. this will save me cycles as i wont be switching over to notepad as much. right now i am looping the data you just saw up top a good 34 times per record. i would rather have 34 variables capture the data then switch over to notepad and paste all 34 variables in one shot. Thanks in advance. Link to comment Share on other sites More sharing options...
Joegio13 Posted December 6, 2006 Author Share Posted December 6, 2006 (edited) $myvar &= ClipGet() & @CRLFOr you could _arrayadd each clipget and use _filewritefromarray.What kind of document is it you're reading? There may be better ways.I am transfering a database that lacks an export feature. so i am copying all fields(first name, last name, address, ect ect) so i wanna get the data from each field and enter it into the new company database. My code works fine, but its code is tooo inefficient. Rather than switching between applications everytime per field i would rather grab all the information per record before switching out. I am transfering the info to notepad as i am making a tab delimited database so that i can be imported into any database, seeing as our new database is structured differently. Edited December 6, 2006 by Joegio13 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 6, 2006 Developers Share Posted December 6, 2006 Ctrl+V = Send("^v") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Joegio13 Posted December 7, 2006 Author Share Posted December 7, 2006 anyone? Link to comment Share on other sites More sharing options...
Uten Posted December 7, 2006 Share Posted December 7, 2006 (edited) Use edxor to monitor and capture new content rather than pasting to notepad. Now you don't have to switch app. You just have to move between the fields.Send("^A"); Select all Send("^C"); Copy Send("{TAB}"); Next field Edited December 7, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Joegio13 Posted December 7, 2006 Author Share Posted December 7, 2006 Use edxor to monitor and capture new content rather than pasting to notepad. Now you don't have to switch app. You just have to move between the fields.Send("^A"); Select all Send("^C"); Copy Send("{TAB}"); Next field here's the updated code. I still need a way to transfer data from the clipboard to a variable, and variable to clipboard. WinActivate("First Program") WinWaitActive("First Program") ; Go to beginning of field Send("{HOME}") ; Select all data in field and copy selected text Send("^a") Send("^c") ; Switch to Notepad WinActivate("Untitled - Notepad") WinWaitActive("Untitled - Notepad") ; Paste copied text Send("^v") ; Press End, insert a comma & press Enter send("{END},{ENTER}") Link to comment Share on other sites More sharing options...
JSThePatriot Posted December 7, 2006 Share Posted December 7, 2006 here's the updated code. I still need a way to transfer data from the clipboard to a variable, and variable to clipboard.Maybe you missed the post from xcal or just ignored it, I don't know but you should pay attention to it. Look up the functions of ClipGet() and ClipPut(). Send("^a") ;Select all text. Send("^c") ;Copy selected text. $variable = ClipGet() ;Retrieves text from clipboard. Also please enclose your code into the [ autoit ]...[ / autoit ] tags. (NOTE: Without any spaces!) I would recommend using FileWrite to write it back to a txt file, or put it into a csv file. I hope this helps a bit, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
mikehunt114 Posted December 7, 2006 Share Posted December 7, 2006 (edited) Look up the functions of ClipGet() and ClipPut().Yep yep. (Since he missed it the first and possibly the second time, maybe three is the charm?)Note: The title of your post is exactly what ClipPut and ClipGet do, try searching the helpfile/forums first. Edited December 7, 2006 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Joegio13 Posted December 7, 2006 Author Share Posted December 7, 2006 i replied to xcal, i just didnt understand what he was getting at, he didnt break it down like u did. thanks all, including xcal. I am gonna look into it, but it looks like exactly what i need. Link to comment Share on other sites More sharing options...
xcal Posted December 7, 2006 Share Posted December 7, 2006 (edited) Sorry, I deleted my original post. I had something like this in mind: $myvar &= $clip & @CRLF. Here's an example of how it would output. Just copy a few things and then press ESC. HotKeySet('{escape}', 'quit') $quit = 0 ClipPut('') $myvar = '' While 1 $clip1 = ClipGet() Do $clip2 = ClipGet() Sleep(50) Until $clip1 <> $clip2 Sleep(50) $myvar &= $clip2 & @CRLF ;this is the magic line sticking clips to one variable WEnd Func quit() MsgBox(0, 'My Clips', $myvar) Exit EndFunc edit - modified slightly (original wasn't consistent). Edited December 7, 2006 by xcal How To Ask Questions The Smart Way 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