3

The title says it all. Is there a way to write macros in JavaScript to achieve a similar functionality to that of Autoit? I just would want to manipulate files on my own computer (offline) and could easily do it with autoit, but since I am currently learning JavaScript -- plan to develop in Node.js -- I figure it wouldn't hurt to get the extra practice.

Thanks guys!

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
Pytth
  • 4,008
  • 24
  • 29

5 Answers5

3

Use an application which supports JavaScript as a shell scripting language, such as the following:

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
1

nodejs has a module which do autoit things --

nodejs install autoit

var au = require('autoit');

au.Init();
au.Run("notepad.exe");
au.WinWait("[Class:Notepad]");
au.Send("Hello, autoit & nodejs!");
xhawk18
  • 169
  • 1
  • 4
0

NodeJS is a very powerfull platform, it is extensible and opensource. There is no problem to run local scripts to do everything you need using JavaScript (see standard FileSystem library docs). You can also try to look in NPM(NodeJS package manager).

Eugene K
  • 388
  • 2
  • 9
0

Assuming you have AutoIt installed (say in folder C:\AU3) and this folder in the PATH, you can add extension '.AU3' to the PATHEXT environment variable, and create an AutoIt script called, say, hello.au3 with just a silly line:

MsgBox(0, "Warning", "Hello, World!")

Now, simply typing the command 'hello' will execute the script, displaying the silly message in a modal message box.

Next, create an equally silly Node.js script, say, MyWarn.js - in the same folder:

var oCP = require("child_process");
console.log("Starting...");
var oNP = oCP.execSync("hello");
console.log("Done.");

Assuming Node is also in the PATH, try this command:

node MyWarn

So ... we get the benefits of Node (for its jit), and the benefits of AutoIt (for its GUI handling.) The problem is getting the two to communicate. Personally, I use a RamDisk to pass small files...

Denis
  • 1
-1

Javascript can't write to a file on your local machine remotely.. Its almost the same as HTML in a view model.

It can however perform some executions of other scripts via AJAX for example. But thats on server again. It might be worth a look to read on server && client side differences.

im not 100% sure but node might offer another outlet on this but it would still be server side.. Not locally.

The Server - This party is responsible for serving pages and handling the logic | Code behind.

The Client - This party requests pages from the Server, and displays them to the user. On most cases, the client is a web browser.

The User - The user uses the Client in order to surf the web, fill in forms, watch videos online, etc.

Pogrindis
  • 7,755
  • 5
  • 31
  • 44
  • Ahh! okay. Thanky you. So you think I should just cruise with Autoit then? Hmm. I can no longer ask questions. Is this a poor quality question? – Pytth Dec 19 '13 at 23:44
  • They will both perform different tasks so you will not be able to do the same thing with javascript as you can with Autoit ! They both offer different features. There is no such thing as a poor quality question ! If you dont know something you can ask or look it up. I would suggest working a little more with javascript though from the beginning before trying to do anything too complicated! ;) – Pogrindis Dec 20 '13 at 10:11
  • 1
    Javascript can write to a file in nodejs, rhino, and other environments. It's been implemented in more than just web browsers. – Kastor Jan 18 '14 at 00:52
  • As i said : im not 100% sure but node might offer another outlet on this but it would still be server side.. Not locally. None the less with nodeJS you are still writing to server, not to client. So my answer was not incorrect .. Your understanding of it was. – Pogrindis Jan 18 '14 at 01:07