Illuvator Posted February 25, 2006 Share Posted February 25, 2006 Hello again, brief question, i want to copy a number from a box on a form to another box on another form (both windows are open) how do i do this? because this does not seem to work First it must generate a number ControlClick("Form1", "", 1005, "$primary") Then must copy that number from the box onto the other form: ControlClick("Form1","",1004, "$primary", 2) Send("^{C}") Then it must paste this onto (say a notepad document) WinActivate("Untitled - Notepad") Send("^{V}") Is that how to go about it? or is there another way? because it seems to not want to select the data in the first form - is that because it is clicking too fast to register? Illuvator Link to comment Share on other sites More sharing options...
pecloe Posted February 25, 2006 Share Posted February 25, 2006 ControlClick("Form1", "", 1005, "$primary") does this highlight the text ? if so then Send("^{INS}") will copy it to the clipboard Link to comment Share on other sites More sharing options...
jefhal Posted February 25, 2006 Share Posted February 25, 2006 Assuming you have two documents open in Notepad: Doc1 and Doc2 and that Doc1 has text in it and Doc2 does not, this will copy the text from one instance to the other: WinActivate("Doc1.txt - Notepad","") ControlSend ( "Doc1.txt - Notepad", "", "Edit1", "^a" ) $var = ControlCommand ( "Doc1.txt - Notepad", "","Edit1" , "GetSelected", "option" ) MsgBox(1,"$var",$var) WinActivate("Doc2.txt - Notepad","") ControlSend("Doc2.txt - Notepad","","Edit1",$var) ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Illuvator Posted February 25, 2006 Author Share Posted February 25, 2006 ControlClick("Form1", "", 1005, "$primary") does this highlight the text ? if so then Send("^{INS}") will copy it to the clipboard thanks for that, and in answer to your question, no it doesnt highlight the text - any ideas how to do that? Link to comment Share on other sites More sharing options...
pecloe Posted February 25, 2006 Share Posted February 25, 2006 (edited) ok so much for the easy way. what kind of document or form is the first one? edit Edited February 25, 2006 by pecloe Link to comment Share on other sites More sharing options...
Illuvator Posted February 25, 2006 Author Share Posted February 25, 2006 I think thats where the problem lies, the number is taken from a random number generating .exe file which my friend wrote (may get on to him to ask him actually) and i wanted to copy the numbers generated to notepad to put them into a file (random number generator for selecting random test sites for a piece of coursework) and hence into my work. No problems, thanks for your help, ill get onto him and see if i can take this further Link to comment Share on other sites More sharing options...
pecloe Posted February 25, 2006 Share Posted February 25, 2006 sorry i couldn't help. Link to comment Share on other sites More sharing options...
Illuvator Posted February 25, 2006 Author Share Posted February 25, 2006 dont worry about it, thanks for your time Link to comment Share on other sites More sharing options...
ChrisL Posted February 25, 2006 Share Posted February 25, 2006 Can you get the text with ControlGetText() from form 1 and ControlSetText() to form 2 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
theguy0000 Posted February 25, 2006 Share Posted February 25, 2006 ClipPut(ControlGetText("Form1","",1004)) The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Illuvator Posted February 25, 2006 Author Share Posted February 25, 2006 Thanks very much to you all (@ theguy) that was what i was looking for, thanks very much . and @ChrisL in the script ControlSetText("Form2", "", 1050, "What do i put in here???" Basically, i have (thanks to theguy got the input on the clipboard, how do i then paste that (not using Send("{V}") using the control set text command? Thanks again to all of you for your assistance, Illuvator Link to comment Share on other sites More sharing options...
ChrisL Posted February 25, 2006 Share Posted February 25, 2006 (edited) $data = ClipGet() ControlSetText("Form2", "", 1050, $data) I still think you would be better not using the clipboard and using ControlGetText(), clipboards can easily get replaced with the wrong data. ControlGetText() would store the value in a Variable and you would put it into the second app in the way above but without the clipput() and clipget() So $data = ControlGetText("Form1","",1004) ControlSetText("Form2", "", 1050, $data) Edited February 25, 2006 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Illuvator Posted February 25, 2006 Author Share Posted February 25, 2006 Thanks very much again. One last question and then i'll cease to trouble you lol. Is there any way I can copy a selection of the digits in a random number (say the first four, or first five) from a string which is say 14 characters long? Is that possible? Thanks very much, you're all extremely hepful Link to comment Share on other sites More sharing options...
greenmachine Posted February 25, 2006 Share Posted February 25, 2006 StringLeft ($String, 4) ; leftmost 4 Or, StringRight ($String, 4) ; rightmost 4 Or, StringMid ($String, $StartNum, $Count) ; any number of chars from any initial place. Default $Count is the rest of the string. 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