1
   

help with opening a program and pasting into a field

 
 
bshul
 
Reply Thu 6 Mar, 2008 02:30 pm
can anyone modify the following code so that windows phone dialer will open with the highlighted text(phone number) pasted into the dial field. Presently the dialer opens with a blank field, when I highlight a phone number and right click on the context menu handler I added called "PHONE"
I am guessing that the variable +searchtext contains the number to be dialed.
The following code which I am trying to use, was written for another phone dialing program and I just substituted "dialer.exe" at the end of the script hoping the highlighted number would be pasted into the windows dialer.exe program.
I'm guessing dialer.exe does not recognize some of the script commands, so the +searchtext info isn't being pasted into the dial field or possibly there is no command to paste the data into the field or there are specific commands that the original program responds to, but the dialer.exe program doesn't. I know very little about java script

Java script as follows.

<SCRIPT>
var parentWin = external.menuArguments;
var doctxt = parentWin.document.body.createTextRange();
var searchtext = new String("");
var good = new String("0123456789-() .");
var x = parentWin.event.clientX;
var y = parentWin.event.clientY;
var clicked;

searchtext = parentWin.document.selection.createRange().text;
if (searchtext == "")
{
doctxt.moveToPoint(x, y);

//-- find a character at mouse click -----
doctxt.moveStart("character", -1);
doctxt.moveEnd("character", 0);
searchtext = doctxt.text;
clicked = searchtext;

//-- move the beginning to the first 'bad' character
while ( good.indexOf(searchtext.charAt(0))!= -1 && searchtext.charAt(0) != '')
{
doctxt.moveStart("character", -1);
searchtext = doctxt.text;
}
doctxt.moveStart("character", 1);
searchtext = doctxt.text;

//-- move the end to the last 'good' character ---
while ( good.indexOf(searchtext.charAt(searchtext.length-1))!=-1 && searchtext.charAt(searchtext.length-1) != '')
{
doctxt.moveEnd("character", 1);
searchtext = doctxt.text;
}
doctxt.moveEnd("character", -1);
searchtext = doctxt.text;

}
//alert ("Selected text is: '" + searchtext + "'");

var wsh = new ActiveXObject('WScript.Shell');

wsh.Run('"C:\\WINDOWS\\DIALER.exe" /'+searchtext);
</SCRIPT>
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 837 • Replies: 0
No top replies

 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » help with opening a program and pasting into a field
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/21/2024 at 08:19:55