Using iMacros for Firefox to run an external exe? - firefox

I want to run an iMacros .js script from the free Firefox version to open an executable file (via the command line).
I want to put this script on a loop, so this has to be done repeatedly.
I have looked online and it looks like the free version does not allow this directly. I am looking for a workaround. Perhaps using a bat file and a scheduler? I am not sure about it.
It looks like it should be simple enough. Is there anyone out there who has done something like this before?
Hamza

This is possible in firefox with this .js command:
var file = Components.classes["#mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("C:\\Users\\Administrator\\Desktop\\app.exe");
file.launch();
You can also launch any app or file of your choice by this.

Related

how to insert an image file into existing ms word file using command prompt?

I am working on Robot Framework. I want to create a report of a test case execution.
I have been trying to insert an image into existing ms word file via command prompt using 'Run' command in Robot framework.
is there any command like echo or edit which does the job?
You may be able to use the Win32::OLE module in Perl to do this. There is an example here.
Or maybe some VBScript with OLE, like here.
Ok guys. I think i will use "EXECUTE JAVASCRIPT" command in RF to solve this. I will have to start a browser every time however. Hope this works as JS has functionality to edit word files.

How do I call out to a command-line program from a gnome shell extension?

I have written a simple shell script to accomplish a common task, and I want to be able to run it whenever a button is clicked. I've used gnome-shell-extension-tool to create the Hello World example already, but now I need to know how to simply have it run an arbitrary command when clicked. There is no input or output to be concerned with; it just needs to run.
After some more creative googling, I've found the solution:
const Util = imports.misc.util;
Util.spawn(['/path/to/program', 'arg1', 'arg2'])
const GLib = imports.gi.GLib;
let stuff = GLib.spawn_command_line_sync("cat hello.txt")[1].toString();
For those looking to read the output of the command, use this.
The default working directory for Gnome shell extensions is the user's home directory.
Just thought I'd mention these things, because it took me a while to figure them out.

How to zip a file in windows shell without vb script and with Window default zip only

Is their a way to zip a file without VB Script.I got a lot of examples on web to zip file or folder using vbs but i want to do it in a single BAT file.
Yes and no. There is no built in way to do this inside windows. You can use a external application like vbscript, a exe file like 7zip, rar, lots of resources can do this. Since windows is application poor when it comes to command lines is not really surprising. But no you do not need the VB Script for anything.
Just not so easy out of the box. Maybe makecab could do it for you? As a general rule you have a hard constraint in your question. A single BAT file which in general can not do almost anything without the support of hundreds of preinstalled or commonly installed other applications.
Could you specify a the constraints a bit better. Tel WHY you need this particular constraint? And what does it mean as even most of the bat command you use require more than one file.

How can I set an AppleScript to run when a given file is modified?

I know that applescripts can be set to run as folder actions, but is there a way to get them to run as file actions? Yes, I know I can work around this by just making a new folder, putting the script in it, and running as a folder action, but I want to know if this can be done.
I cross-posted this question to Apple's Applescript discussion board, and a few users there gave some solutions that use only system resources, with no third-party applications. Follow the link to see the answers.
Basically you need to use launchd to watch a file and launch a script when the file changes. Then you'd need to craft a .plist that describes the script to run and the file(s) or directories to watch.
There's no simple built in way to do this. However there's lots of ways to set up an Applescript to run. However in general you'll have to do some non-Applescript coding.
Check out the info in this hint and OSXHints:
http://hints.macworld.com/article.php?story=20060817044149264
They have a Python script demonstrating using fsevents.so to monitor file changes. You would then just modify the Python to call your Applescript (or simply use Appscript to do the scripting from within Python).
Alternatively you can just have a program check a file at a particular interval and then run if the file changes. This hint describes that in Perl:
http://hints.macworld.com/article.php?story=20031001073403810
I found a way to do this that works.
Shell script:
find watchedfilepath -mtime -1 -exec cp {} watchedfolderpath ';'
Create a Calendar Event in Automator to run this shell script which will check the file. If it has been modified in the last 24 hours, then it will be copied to the watched folder. Then create an action in Automator to move it to trash (otherwise the next time the shell script runs it won't work).
Set up a Folder Action on the watched folder to watch for an added new item and then it will let you know. I have created a script to send me an email and put that in the Folder Actions folder in Library/Scripts. It works like a treat.
This is an old question, but the Apple Automator tool in MacOS does exactly this. You can set it to watch a folder and execute an Applescript, Shell Script, etc.

Windows Autorun for an HTML file

I have a html file on a flash drive that I would like to autorun in Windows. I have found examples of multiple ways to do this but none of them are working for me. Anyone see what I am doing wrong?
This is my latest Attempt:
[autorun]
icon=data/favicon.ico
label=My Project
open=ShellRun.exe OPEN-ME.htm
This was another attempt:
[autorun]
icon=data/favicon.ico
label=My Project
shellexecute=OPEN-ME.html
shell\openme=Learn More About My Project
shell\openme\command=OPEN-ME.html
shell=openme
Some of this is working, like the icon and the label. Just not the auto run.
You might try to use VBScript or JScript:
test.vbs (VBScript):
Call WScript.CreateObject("WScript.Shell").Run("OPEN-ME.html", 1)
test.js (JScript):
WScript.CreateObject("WScript.Shell").Run("OPEN-ME.html", 1)
Either way, it should do what you want as far as I'm aware.
Edit: By the way, ShellRun.exe is most likely a program bundled with a piece of software known as ShellRun rather than a built-in Windows command. The idea is that you can use the executable in your AutoRun file to launch an arbitrary file.

Resources