DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Nany 2014 Entry - Early Alpha - JsRoboKey  (Read 16,054 times)

relipse

  • I love Jesus. Coding in PHP primarily.
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 131
    • Participated in NANY Challenge Seven Times
Nany 2014 Entry - Early Alpha - JsRoboKey
« on: September 14, 2013, 05:01 AM »
I am announcing JsRoboKey as one of my entries to NANY 2014. Right now it is pre-alpha but it's got some starter features similar to AutoHotkey.
I hope to get version 1.0 in by the new year!

In case you want some teasers, the app sits in the tray (similar to ahk) and will run a script. Here are some examples (go to http://github.com/relipse/JsRoboKey for more readable format):


Example Scripts
---------------

###### sendKeys()
A simple script might look like this:
Code
    //run notepad, wait a little bit for it to open, then send some keystrokes
    rk.run('notepad');
    rk.sleep(700);
    rk.sendKeys('abcdefgABCDEFG1234567890!@#$%^&*()');

###### addGlobalHotkey()
Or even better, trigger to run notepad after a certain hotkey!
Code
rk.addGlobalHotkey('Meta+Alt+N', function(){
   rk.run('notepad');
});
(Meta) means the Windows key


###### getForegroundWindow() and getWindowText()
And demonstrating some new functionality, this script will run notepad and wait for it to open
Code
function fgWinMatches(winTitle){
    var hwnd = rk.getForegroundWindow();
    var title = rk.getWindowText(hwnd);
    if (title.toLowerCase().indexOf(winTitle.toLowerCase()) >= 0){
       return {hwnd:hwnd,title:title};
    }else{
       return false;
    }
}

function winWait(winTitle, callback){
   var match = fgWinMatches(winTitle);
   if (match === false){
      rk.setTimeout(function(){
         winWait(winTitle, callback);
      },400);
   }else{
     callback(match);
   }
}

rk.run('notepad');
winWait('notepad', function(match){
    rk.sendKeys('Hello World');
});
###### onClipboardChange()
A new feature onClipboardChange() which sets up a callback when the clipboard changes, think of the possibilities!
Code
rk.onClipboardChange(function(data){
    if (typeof(data) != 'string'){ return; }
    if (data.indexOf('foobar') >= 0){
       rk.alert('foobar on clipboard: ' + data);
    }
});

###### onKeyPress() onKeyRelease()
*unstable* not yet in master (hotfix_keylisten branch)
Code
rk.allowKeyListen();
rk.onKeyRelease(function(key){
   if (key == 'F7'){
     rk.sendKeys('Hello World F7'); 
   }
});

###### trayMsg()
demonstrating a few of the latest features as well,
after the tray bubble message gets shown, the callback gets called when the user clicks the tray message
Code
rk.trayMsg('Hi','Check if JsRoboKey executable file exists...', function(){
   alert(__APPFILEPATH__ + ' exists: ' + 
           rk.fileExists(__APPFILEPATH__));
});


rk.trayMsg('About','Click to open the JsRoboKey website', function(){
    rk.openUrl('http://github.com/relipse/JsRoboKey');
});
Ex C++Builder coder, current PHP coder, and noob Qt Coder

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: Nany 2014 Entry - Early Alpha - JsRoboKey
« Reply #1 on: September 14, 2013, 10:30 AM »

Hallo!

What's the "angle"? When people do stuff similar to something else, there's usually at least one aspect that's inspiring the attempt to improve on or fix something! So what's the nifty starter finesse that is inspiring this entry? I don't know anything about ahk so try to make it easy for us newbies!

:)
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

relipse

  • I love Jesus. Coding in PHP primarily.
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 131
    • Participated in NANY Challenge Seven Times
Re: Nany 2014 Entry - Early Alpha - JsRoboKey
« Reply #2 on: September 25, 2013, 08:59 PM »
Honestly ahk did such a great job writing their little powertool to do pretty much anything you need in windows. It's downfall - it's not cross-platform and the language is nothing like a programming language in my opinon. JsRoboKey's aim is to Have at least the powerful features in the familiar javascript syntax using the powerful v8 engine.
Ex C++Builder coder, current PHP coder, and noob Qt Coder

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Re: Nany 2014 Entry - Early Alpha - JsRoboKey
« Reply #3 on: October 08, 2013, 02:21 AM »
Glad you're participating, relipse. Your project looks quite interesting.
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

theGleep

  • Supporting Member
  • Joined in 2014
  • **
  • Posts: 28
Re: Nany 2014 Entry - Early Alpha - JsRoboKey
« Reply #4 on: August 01, 2014, 03:43 PM »
Hi, Relipse!

I love this idea - and have considered doing the same thing quite a few times.

Unfortunately, I think there could be a better way to go about it - have  you looked into Node.js?

It's a javascript engine - so half of the work is already done for you.  Plus, there are already plugins to load native code files (DLLs in Windows ... but I *think* it's cross-platform, so can load whatever-it-is-that-*nix-platforms-use-for-DLLs (I can't remember what they're called!)) - so 2/3 of the work is already done.  

All that's left, really, is bundling up a bunch of wrapper calls into a node package to mimic the AHK feature-set.

I just wish there were 8 of me so I could have done it already... :)
Computer Programmer by day
Dreamer at night

Original address: https://www.donationcoder.com/forum/index.php?topic=36123.0