Page 1 of 1
Copy Typed String and Paste it into a Text Field
Posted: 29 Apr 2011 21:33
by alleypuppy
Hello. Is there a way to type a string into a batch file and have that typed string copied into some text field. I'm assuming that you would use VBScript, but I don't know how to do it. Thanks for any help!
Re: Copy Typed String and Paste it into a Text Field
Posted: 15 Sep 2011 01:15
by shiva
Hi,
I have created a batch script to read and save a string entered.
I don't know Vb script but i have tried to use in java,
a.bat:
set /p choice="enter string"
echo you have entered %choice%
java a.class %choice%
a.java file should be designed in such a way that it take a argument and place that argument
in that required text field,
thank you
shiva shankar
Re: Copy Typed String and Paste it into a Text Field
Posted: 15 Sep 2011 16:06
by nitt
alleypuppy wrote:Hello. Is there a way to type a string into a batch file and have that typed string copied into some text field. I'm assuming that you would use VBScript, but I don't know how to do it. Thanks for any help!
Filling in a text field with VBScript/JScript on the internet is rather easy, but for an unexperienced person, it can feel rather hard. But there is an easier way that even the noobiest of the noobs could understand. This way is just simply to just use the "sendkeys" method to fill in some kind of a field. For example:
VBScript:
Code: Select all
@echo off
echo createobject("wscript.shell").sendkeys("I love pie!") > ~tmp.vbs
start notepad
ping 0 -n 1 > nul
~tmp
ping 0 -n 1 > nul
del ~tmp.vbs
pause
JScript:
Code: Select all
@echo off
echo new ActiveXObject("wscript.shell").sendkeys("I love pie!") > ~tmp.js
start notepad
ping 0 -n 1 > nul
~tmp
ping 0 -n 1 > nul
del ~tmp.js
pause
I use the "ping" command just to space it out, I've had experiences where if you don't do that then it will disallow you to delete the file at the end.
And "sendkeys" basically just controls your keyboard. Use something like "^a" to select all text in a field then use "^c" to copy it, and like "^p" to paste it.
Re: Copy Typed String and Paste it into a Text Field
Posted: 21 Sep 2011 10:18
by Ranguna173
Here is a simple batch code that saves variables in files
Code: Select all
@echo off
echo What do you want to write on the file?
echo (first line)
set /p fl=
cls
echo What do you want to write on the file?
echo (second line)
set /p sl=
cls
echo What do you want to write on the file?
echo (third line)
set /p tl=
cls
echo Type the name of the file.
set /p name=
echo %fl%>%name%
echo %sl%>>%name%
echo %tl%>>%name%
cls
echo A file named %name% as been created in this directory.
pause
exit