Skip to content

Instantly share code, notes, and snippets.

@satyr
Created October 4, 2009 11:52
Show Gist options
  • Save satyr/201343 to your computer and use it in GitHub Desktop.
Save satyr/201343 to your computer and use it in GitHub Desktop.
#!perl
use strict;
use warnings;
use Net::Telnet;
use Win32::OLE;
my $mr = Net::Telnet->new(Port => 4242, Prompt => '/repl> /', Timeout => 1);
$mr->open();
$mr->cmd('{
content.focus();
let Cu = Components.utils;
let {ctypes: ct} = Cu.import("resource://gre/modules/ctypes.jsm", null);
let k32 = ct.open("kernel32");
let pid = k32.declare("GetCurrentProcessId", ct.stdcall_abi, ct.int32_t)();
k32.close();
pid;
}');
my $pid = $mr->getline;
Win32::OLE->new('WScript.Shell')->AppActivate($pid);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment