banjoman Posted September 11, 2005 Share Posted September 11, 2005 I am making an application with MultiMediaBuilder that contains a word bank, when a word is clicked that word is copied to the windows clipboard how can I paste this text into a word processor window? do I have to name the target window or can I search for a word processor window that is open, make it active and then paste into it? Link to comment Share on other sites More sharing options...
is8591 Posted September 12, 2005 Share Posted September 12, 2005 I am making an application with MultiMediaBuilder that contains a word bank, when a word is clicked that word is copied to the windows clipboardhow can I paste this text into a word processor window?do I have to name the target window or can I search for a word processor window that is open, make it active and then paste into it?<{POST_SNAPBACK}>Use window spy to get window name and then ControlSend "Ctrl C" like thisControlSend("WinName","","^C")Just remember it willl paste at whatever cursor position in Word Processor Link to comment Share on other sites More sharing options...
LxP Posted September 12, 2005 Share Posted September 12, 2005 (edited) is8591's on the right track, however this will most likely send Ctrl+Shift+C because of the capital C. This should work for you if that doesn't (actually it should probably be Ctrl+V):Edit: Missing a pair of empty quotes.controlSend("WinName", "", "", "^v") Edited September 13, 2005 by LxP Link to comment Share on other sites More sharing options...
is8591 Posted September 12, 2005 Share Posted September 12, 2005 is8591's on the right track, however this will most likely send Ctrl+Shift+C because of the capital C. This should work for you if that doesn't (actually it should probably be Ctrl+V):controlSend("WinName","","^v")<{POST_SNAPBACK}>Thanks LxP - you absolutely right. Control C is for copying and V is for pasting.That's what I get for relying on my functions too much - I do all my copy-paste from Excel and actual key sequences are in GetCell and PutCell Link to comment Share on other sites More sharing options...
banjoman Posted September 12, 2005 Author Share Posted September 12, 2005 thanks for that, could you be more specific about window spy - if there is a word processor window open what script command do I use to get its name and then how do I feed that into the ControlSend command? I envisage this AutoIt script will be compiled in to an .exe file which can then be run from the word bank program, so the AutoIt script will have to do this (I think); 1) detect a word processor window and get its window name 2) activate it (I assume because if the user has clicked the word bank programme that window will be the active one on the desktop?) 3) feed the word processor window name into the ControlSend command 4) carry out the ControlSend command then, hey presto, the word chosen from the word bank will be pasted into the word processor document at the cursor position!! Link to comment Share on other sites More sharing options...
is8591 Posted September 12, 2005 Share Posted September 12, 2005 thanks for that, could you be more specific about window spy - if there is a word processor window open what script command do I use to get its name and then how do I feed that into the ControlSend command?I envisage this AutoIt script will be compiled in to an .exe file which can then be run from the word bank program, so the AutoIt script will have to do this (I think);1) detect a word processor window and get its window name2) activate it (I assume because if the user has clicked the word bank programme that window will be the active one on the desktop?)3) feed the word processor window name into the ControlSend command4) carry out the ControlSend commandthen, hey presto, the word chosen from the word bank will be pasted into the word processor document at the cursor position!!<{POST_SNAPBACK}>Window spy is AutoIt Window Info and comes with AutoIt.Activate your word processor and then AutoIt Window Info.Position mouse on word processor window and watch in Window tool:ControlIDClassNameNNTextwhen those fields show info about your word processor window press CTRL-ALT-Fthat will freeze Window Info.Now copy & paste ControlID or Classname into "FileName" in ControlSendeither one can be used. When executing you don't need to activate Word Processor window because ControlSend will work with any window/control even without focus Link to comment Share on other sites More sharing options...
banjoman Posted September 12, 2005 Author Share Posted September 12, 2005 thanks again, it is so good having a responsive forum to get quick answers and advice from I think I have enough info now to start experimenting Link to comment Share on other sites More sharing options...
banjoman Posted September 13, 2005 Author Share Posted September 13, 2005 hey presto has not worked yet this works:- controlSend("Document1 - Microsoft Word","","_WwG1","text in a Word window") but this does not:- controlSend("Document1 - Microsoft Word","","_WwG1","^v") nor this:- controlSend("Document1 - Microsoft Word","","_WwG1","^V") I have tried all sorts of ways of sending the paste command (looking up the 'send' command in the AutoIt help file), but have not been successful as yet any ideas anyone? Link to comment Share on other sites More sharing options...
BigDod Posted September 13, 2005 Share Posted September 13, 2005 (edited) hey presto has not worked yetthis works:-controlSend("Document1 - Microsoft Word","","_WwG1","text in a Word window")but this does not:-controlSend("Document1 - Microsoft Word","","_WwG1","^v")nor this:-controlSend("Document1 - Microsoft Word","","_WwG1","^V")I have tried all sorts of ways of sending the paste command (looking up the 'send' command in the AutoIt help file), but have not been successful as yetany ideas anyone?<{POST_SNAPBACK}>I have tried it and it works as long as Microsoft Word is not minimised.EDITYou will find that the first one does not work if Word is minimised. Edited September 13, 2005 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
banjoman Posted September 13, 2005 Author Share Posted September 13, 2005 yeah, it does, I must have been trying it with Windows minimized I guess, but did not notice thanks 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