Reputation: 4176
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!
Upvotes: 3
Views: 5054
Reputation: 24627
Use an application which supports JavaScript as a shell scripting language, such as the following:
Upvotes: 3
Reputation: 189
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!");
Upvotes: 1
Reputation: 1
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...
Upvotes: 0
Reputation: 8121
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.
Upvotes: -1
Reputation: 388
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).
Upvotes: 0