home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cenvi23.zip / NEWPSWRD.CMD < prev    next >
OS/2 REXX Batch file  |  1996-02-12  |  2KB  |  65 lines

  1. EXTPROC CEnvi2
  2. //***********************************************************
  3. //*** New Password - Use keystroke emulation to set a new ***
  4. //*** ver.2          password.  This is kind of kludgy in ***
  5. //***                that it must know exactly what keys  ***
  6. //***                to press to get to the password page ***
  7. //***********************************************************
  8.  
  9. Instructions()
  10. {
  11.    puts(`NewPswrd - Set new lockup password`)
  12.    puts(``)
  13.    puts(`USAGE: NewPswrd <Password>`)
  14.    puts(``)
  15.    puts(`WHERE: Password - New lockup password`)
  16.    puts(``)
  17.    puts(`EXAMPLE: NewPswrd "blimblam"`)
  18.    puts(``)
  19.    puts(`NOTE: BE CAREFUL!  Don't forget your password.`)
  20.    puts(``)
  21.    exit(EXIT_FAILURE);
  22. }
  23.  
  24. #include <KeyPush.lib>
  25.  
  26. main(argc,argv)
  27. {
  28.    if ( 2 != argc || !argv[1][0] )
  29.       Instructions();
  30.     Password = argv[1];
  31.  
  32.    // remember active window
  33.    ActiveWindow = GetActiveWindow();
  34.  
  35.    // make the desktop the active window
  36.    SetActiveWindow("Desktop");
  37.  
  38.    // send the keystrokes to get the desktop settings page
  39.    KeyStroke(VK_CTRL,'\\');
  40.    KeyStroke(VK_SHIFT,VK_F10);
  41.    KeyStroke('S');
  42.    suspend(2000);  // give settings page time to show itself
  43.  
  44.    // get the last page of the lockup section, which is one
  45.    // page before Archive
  46.    KeyStroke('A');
  47.    KeyStroke(VK_BACKTAB);
  48.    KeyStroke(VK_LEFT);
  49.    KeyStroke(VK_ENTER);
  50.  
  51.  
  52.    // enter the password twice, press enter to accept
  53.    KeyStroke(Password)
  54.    KeyStroke(VK_TAB);
  55.    KeyStroke(Password)
  56.    KeyStroke(VK_ENTER);
  57.  
  58.    // ALT-F4 to close the settings
  59.    KeyStroke(VK_ALT,VK_F4);
  60.  
  61.    // restore original active window
  62.    SetActiveWindow(ActiveWindow);
  63. }
  64.  
  65.