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

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.

Related

Using iMacros for Firefox to run an external exe?

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.

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.

Can XSLT execute a shell script at the OS level?

I have a production flow that combines XSLT and some shell scripts in about 4 steps before it reaches completion. I execute each step manually at the moment.
I'm using Saxon 9 from the command line in Linux. Can I have the xsl's execute shell scripts.. instead of me?
(I know I could achieve the desired result in another way with Ant or Make.. but prefer to stay in XSLT if it is not a huge effort to do so)
Update: I've minimized my shell scripts and sped things up using Xproc. I'm not entirely satisfied with the result, but Xproc has improved life. Kai's suggestion below looks good.. but I have not tried it yet.
I'm not Java savvy either, but I found with Michael Kay's tutorials on the Saxonica website it's doable.
Here's what I did and what's working well for me:
In the root element of the XSLT stylesheet I assigned a namespace for the function (in my case I'm using it for unzipping, so I named the prefix unzip, but that could certainly be anything):
xmlns:unzip="java:java.lang.Runtime"
I am defining a variable with a file path for a batch file to be called later. Then I am using
<xsl:result-document href="{$batchFile}" method="text"> ... </result document>
to create the batch file. (Unzipping could be certainly done with just a command, but I found the batch file version more handy as I needed to combine the unzip-command with some change directory command and other little stuff. And furthermore using a batch file opens up a world of more elaborate tasks that could be called from the XSLT sheet.)
When I need my batch file be executed, I insert an xsl:message like this:
<xsl:message>Executing <xsl:value-of select="unzip:exec(unzip:getRuntime(),concat('cmd /c /y start ',$batchFile))"/></xsl:message>
Hope that helps,
best regards,
Kai
You can call java.lang.Runtime.exec() in the same way as any other external Java function.

How do I make sense of a batch file?

I have no prior experience working with batch files or shell scripting in general. I need to understand the operations being carried out by a batch file used in a related project. Any resource that gives exhaustive list of batch file commands and what each one does?
Once you get acquainted with the general .BAT file information, using some of the pointers to useful information that other users have posted in the other answers, you might try some of the following strategies that help you understand and analyze the BAT files used int your projects:
add an ECHO command in front of all command invocations
read HELP command for each command line in the BAT file
execute at the command prompt each command line in the BAT file
remove the #echo off at the top of the .BAT file, and see how the BAT progresses
add some PAUSEs to keep viewing some commands on screen before they disappear.
There are some useful answers here in this Stack Overflow question: Best free resource for learning advanced batch-file usage?
As well there are quite a few resources available through google search for Batch file resources, as well as the Wikipedia entry http://en.wikipedia.org/wiki/Batch_files
That should get you started at least.
A little search on google should give a lot of tutorials and websites with information on writing them for both Windows and Linux.
Maybe you should start from the beginning though.
http://ss64.com/nt/
http://academic.evergreen.edu/projects/biophysics/technotes/program/batch.htm
http://www.robvanderwoude.com/batchcommands.php
http://en.wikipedia.org/wiki/List_of_MS-DOS_commands
They're just a few examples i found with a little google search. You should search it and find something thats better for you.
Hope this helps.

Running Macro in Notepad++ from Commandline

Is it possible to run a Macro which i record in Notepad++ from the Commandline? Say i record a Macro to search and replace, which i can run in Np++ for the whole text file, i would like to do this kind of Job in a Shell file, is this possible? I couldnt find anything about this in the Documentation.
If not possible can anybody recommend alternative easy to use porgrams for this kind of Job?
Thank you
I haven't seen any documentation on doing this in Np++, but I am pretty sure you can do it in UltraEdit. This is not a free product, though.

Resources