Advertisement
jcunews

PromptRun.hta

Mar 1st, 2022
1,445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.44 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3.   <head>
  4. <!--
  5.  This is an HTML Application. It must be saved as a .hta file.
  6.  While it's in HTML format, it's not meant to be opened under a web browser.
  7.  But it does require Internet Explorer 7+, and Windows XP or later.
  8.  Windows already handles HTA files out of the box.
  9.  Simply double-click the file to run it.
  10. -->
  11.     <meta http-equiv="x-ua-compatible" content="IE=9" />
  12.     <title>Prompt Run</title>
  13.     <style>
  14. body { margin:3vh 1.69vw; font-size:12pt }
  15. div { height:10vh }
  16. #t {
  17.   display:block; margin-bottom:3vh; box-sizing:border-box; width:96.62vw;
  18.   height:74vh
  19. }
  20. button { margin:0 10vw; width:5em }
  21.     </style>
  22.   </head>
  23.   <body>
  24.     <div>
  25.       Please enter command line arguments for: <span id=s></span>
  26.     </div>
  27.     <textarea id=t></textarea>
  28.     <center>
  29.       <button id=o>OK</button><button id=c>Cancel</button>
  30.     </center>
  31.     <hta:application id=h innerborder=no scroll=no></hta:application>
  32.     <script>
  33. z = screen.height / 2;
  34. resizeTo(z / 3 * 4, z);
  35. if (!(a = h.commandLine.match(/^(?:".*?"|\S+)\s+(".*?"|\S+)\s*(.*)/))) {
  36.   alert('Usage: PromptRun.hta {program file} [initial arguments...]');
  37.   close()
  38. }
  39. s.textContent = a[1];
  40. t.value = a[2];
  41. c.onclick = function(){
  42.   close()
  43. };
  44. o.onclick = function() {
  45.   (new ActiveXObject('wscript.shell')).run(s.textContent + ' ' + t.value);
  46.   close()
  47. };
  48. t.selectionStart = t.value.length;
  49. t.focus();
  50.     </script>
  51.   </body>
  52. </html>
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement