SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with setTimeout and app.Activate

    Hello,

    Iam 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 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 allow 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.
    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>

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    ActiveX is not really covered on here.

    You should go to the Microsoft: ActiveX Forum instead.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •