bshul
April 11th, 2008, 11:33 AM
Hello,
I am trying to finish some javascript, which will copy to clipboard, a highlighted phone number on a IE6 webpage,
then execute the Win98 phone dialer program,
then paste the number into the input field of the program
then press the Dial button
then wait 5 seconds
then terminate the running program by closing the 2 program windows that were generated.
I have so far accomplished
the copy to clipboard
the execute Dialer.exe program
and the activation of the Dial button.
There are a few problems presently.
I can only paste to the Dialer.exe program, if I first execute another program. This I believe is because I need a time delay between calling the Dialer.exe program and issuing the paste command, to allow the program to start running. I have not been successful using setTimeout("wsh.Sendkeys ('^V')",1000); to accomplish the delay before pasting. Instead I call notebook.exe which seems to allows the dialer.exe to receive the paste command. Is this a timing or program focus problem?
I also need the javascript to wait 5 seconds before sending 2 ALT F4 commands
setTimeout("wsh.Sendkeys ('%{F4}')",5000);
setTimeout("wsh.Sendkeys ('%{F4}')",5100);
Here is the code, with the non working code remarked out.
I am not a programmer, so please help me with code, versus general javascript theory.
I am running Wscript 5.6. Thank you all so much.
<script language="javascript"type="text/javascript">
{var SelectedText =window.external.menuArguments.document.selection.createRange().text;
window.clipboardData.setData("Text",SelectedText);}
var wsh = new ActiveXObject('WScript.Shell');
//setTimeout("wsh.Sendkeys ('^V')",1000);
wsh.Run("C:\\WINDOWS\\notepad.exe");
wsh.Run("C:\\WINDOWS\\Dialer.exe");
wsh.Sendkeys ("^V");
wsh.SendKeys ("{ENTER}");
//setTimeout("wsh.Sendkeys ('%{F4}')",5000);
//setTimeout("wsh.Sendkeys ('%{F4}')",5100);
</SCRIPT>
I am trying to finish some javascript, which will copy to clipboard, a highlighted phone number on a IE6 webpage,
then execute the Win98 phone dialer program,
then paste the number into the input field of the program
then press the Dial button
then wait 5 seconds
then terminate the running program by closing the 2 program windows that were generated.
I have so far accomplished
the copy to clipboard
the execute Dialer.exe program
and the activation of the Dial button.
There are a few problems presently.
I can only paste to the Dialer.exe program, if I first execute another program. This I believe is because I need a time delay between calling the Dialer.exe program and issuing the paste command, to allow the program to start running. I have not been successful using setTimeout("wsh.Sendkeys ('^V')",1000); to accomplish the delay before pasting. Instead I call notebook.exe which seems to allows the dialer.exe to receive the paste command. Is this a timing or program focus problem?
I also need the javascript to wait 5 seconds before sending 2 ALT F4 commands
setTimeout("wsh.Sendkeys ('%{F4}')",5000);
setTimeout("wsh.Sendkeys ('%{F4}')",5100);
Here is the code, with the non working code remarked out.
I am not a programmer, so please help me with code, versus general javascript theory.
I am running Wscript 5.6. Thank you all so much.
<script language="javascript"type="text/javascript">
{var SelectedText =window.external.menuArguments.document.selection.createRange().text;
window.clipboardData.setData("Text",SelectedText);}
var wsh = new ActiveXObject('WScript.Shell');
//setTimeout("wsh.Sendkeys ('^V')",1000);
wsh.Run("C:\\WINDOWS\\notepad.exe");
wsh.Run("C:\\WINDOWS\\Dialer.exe");
wsh.Sendkeys ("^V");
wsh.SendKeys ("{ENTER}");
//setTimeout("wsh.Sendkeys ('%{F4}')",5000);
//setTimeout("wsh.Sendkeys ('%{F4}')",5100);
</SCRIPT>