Stefan22 Posted June 24, 2008 Share Posted June 24, 2008 I need to make a script which copy's a selected area, for example I'm selecting the text "abcdef" then it has to copy it to the selected area by pressing the button F11 for example. Does anyone know how u might get this working? Stefan Link to comment Share on other sites More sharing options...
AlmarM Posted June 24, 2008 Share Posted June 24, 2008 Hello, You could use this? HotKeySet("{F11}", "_Copy") While 1 Sleep(100) WEnd Func _Copy() $FocusThing ;Something with any Focus command? (Cant test it now) ClipPut($FocusThing) EndFunc -AlmarM- Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Stefan22 Posted June 24, 2008 Author Share Posted June 24, 2008 Getting a Error, C:\bla bla bla\AUTOIT Files\tester.au3 (8) : ==> Expected a "=" operator in assignment statement.: $Focus $Focus^ ERROR Link to comment Share on other sites More sharing options...
Stefan22 Posted June 24, 2008 Author Share Posted June 24, 2008 (edited) I need a script that copy's for a example some text from notepad to a specified area / inputbox. This might be any useful? >>>> Window <<<< Title: MAKEDROP © JulMar Entertainment Technology, Inc. Class: #32770 Position: 878, 113 Size: 371, 398 Style: 0x94C800C4 ExStyle: 0x00050101 Handle: 0x000C0240 >>>> Control <<<< Class: Edit Instance: 1 ClassnameNN: Edit1 Advanced (Class): [CLASS:Edit; INSTANCE:1] ID: 1000 Text: Position: 92, 52 Size: 134, 20 ControlClick Coords: 9, 9 Style: 0x50012080 ExStyle: 0x00000204 Handle: 0x000901E8 >>>> Mouse <<<< Position: 982, 203 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> Visible Text <<<< Available Line Devices: H323-verbinding Number to Dial: Timeout: 1000 Spin1 &Start State to Drop on: Busy >>>> Hidden Text <<<< This is the 'box' that has to be filled with the copied text. Edited June 24, 2008 by Stefan22 Link to comment Share on other sites More sharing options...
Triblade Posted June 24, 2008 Share Posted June 24, 2008 Did you copy that code one-on-one? Looks that you didn't fill the $FocusThing variable with the selected text Like $FocusThing = "Selected text" My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
TerarinKerowyn Posted June 24, 2008 Share Posted June 24, 2008 Do you want to select all | selectively choose | have the computer copy it all or what kinda copy are you trying for? Because with a focus is something to do with having the computer copy it all or selectively choose Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah Link to comment Share on other sites More sharing options...
will88 Posted June 24, 2008 Share Posted June 24, 2008 (edited) Getting a Error, C:\bla bla bla\AUTOIT Files\tester.au3 (8) : ==> Expected a "=" operator in assignment statement.:$Focus$Focus^ ERRORyou need to declare your variable by using the =edit: got replyed to quicker than I posted I guess lol Edited June 24, 2008 by will88 Password-Keeper Link to comment Share on other sites More sharing options...
Triblade Posted June 24, 2008 Share Posted June 24, 2008 I think the command you are truely looking for is: ControlSend Look that up in the help file, try to fiddle with it and search the forum for any questions you might have. This command sends text to a control (or 'selected area' if you wish) My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
Stefan22 Posted June 24, 2008 Author Share Posted June 24, 2008 Yes, I want to select some text, and when I'm pressing the button F11 for example is has to copy it to the ControlID I gave you in the summary. And the text is has to copy can be different all the time btw. Link to comment Share on other sites More sharing options...
Stefan22 Posted June 24, 2008 Author Share Posted June 24, 2008 I think the command you are truely looking for is: ControlSendLook that up in the help file, try to fiddle with it and search the forum for any questions you might have.This command sends text to a control (or 'selected area' if you wish)This won't work im afraid, hmm or is it possible to send different kinds of text with this command? Thought this was like ControlSend("123456789") so the text is always the same in the script, I want it to be different all the time. Link to comment Share on other sites More sharing options...
Triblade Posted June 24, 2008 Share Posted June 24, 2008 We've pm'd some msg's and this came outta it as working: (It works at least with 2 notepad window's. We did, however, had to use a portion of the original title because it seems that . and , and such can not be used as a title) HotKeySet("{F11}", "copysel") While 1 Sleep(50) WEnd Func copysel() $selected = ControlCommand("sourcetitle", "", "Edit1", "GetSelected", "") ;MsgBox(0, "", $selected) ControlCommand("targettitle", "", "Edit1", "EditPaste", $selected) EndFunc Exit My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) 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