Running Automator app/service as command from an Application

I want to create an Automator app or service to be called from a script editor.  Which action would allow me to retrieve the filename/filepath that was being edited by that application?  Also, the editor has a "run command" feature that I planned to use to run the automator app.  What type of automator app should I create to be able to run it as a command?

Friends, i've got, where the problem is.
when we run a class file directly from a command prompt, we get an environment with that shell window. but for a servlet application running these kind of commands from a class creates kind of child processes. each and every command is executed as a child process of jvm and don't get those environment. we have 'PATH' variable in the environment. when a command (say, 'dir' or 'sh' or 'ls', etc.) is executed, the shell first search for that executable file (i.e. dir / sh / ls) in the given paths in the variable 'PATH'. this is not available for the child commands of jvm. hence the basic commands are searched in the current directory of the jvm and they are failed.
i solved the problem giving full path of the commands. like :
p = rt.exec("/bin/sh runningScript.ksh")

Similar Messages

  • Can I execute MySql's command from java application?

    Can I execute MySql's command from java application? And how?
    For example :
    load data local infile 'D:\\myData.txt'
    into table myTable
    fields terminated by ';'
    lines terminated by '\n';

    1. get the jdbc driver for mysql from the mysql site at: http://dev.mysql.com/downloads/connector/j/5.0.html
    2. follow the installation instructiions... which you'll also find in your mysql manual...
    Happy travels. Keith.

  • Problem running Automator .app on different machine

    Hello,
    I have written an Automator application (QuitTunes.app) that resides on my Mac No 1 machine. It quits iTunes when invoked for my Mac No 1.
    I have another Automator application (RunQuitTunes.app) that resides on my Mac No 2 machine. It runs QuitTunes.app which is located on Mac No 1.
    When I run RunQuitTunes.app from Mac No 2 both apps run, but the problem is that iTunes quits on machine Mac No 2 instead of Mac No 1.
    Any ideas....
    Thanks

    Hi, sorry.. i was a little busy..
    i tried a simple hello world, and it DID work..
    is there anything i need to take into account for
    vista?

  • Running Unix Command from WEB-APPLICATION

    Hi all,
    I want to run unix command from a java-based web application. the basic code part is this ---
    public class RunCommand
          public String runIt()
              String s = null, returnString = "";
              Process p=null;
              try
                       Runtime rt = Runtime.getRuntime();
                  p = rt.exec("sh testPOC.ksh");
                  p.waitFor();
                  BufferedReader stdInput = new BufferedReader(new
                       InputStreamReader(p.getInputStream()));
                  BufferedReader stdError = new BufferedReader(new
                       InputStreamReader(p.getErrorStream()));
                  // read the output from the command
                  returnString += "Here is the standard output of the command:<br>";
                  while ((s = stdInput.readLine()) != null) {
                      returnString += s;
                  // read any errors from the attempted command
                  returnString += "Here is the standard error of the command (if any): <br>";
                  while ((s = stdError.readLine()) != null) {
                      returnString += s;
              catch (IOException e)
                  returnString += "exception happened - here's what I know: ";
                  returnString += "error-> " + e.getMessage();
              catch(Exception e)
                returnString += "exception happened - here's what I know: ";
                  returnString += "error-> " + e.getMessage();
              return returnString;
      }this class is kept as an inner class. The control comes to its outer class, from servlet, from which the runit() is called. but the exception is occuring at line of p=rt.exec(.....). it tells "<command name> : not found transaction completed" [got this using getMessage() method].
    i am unable to show(and see, too) the stacktrace, because i don't have access to that test environment and its log. i can't run this in local because its windows one.
    now can anyone tell me, where is the problem. is there any limitation in web application server/container? this was successful when i used command prompt writing a .java file. Please help me. Thanks in advance...

    Friends, i've got, where the problem is.
    when we run a class file directly from a command prompt, we get an environment with that shell window. but for a servlet application running these kind of commands from a class creates kind of child processes. each and every command is executed as a child process of jvm and don't get those environment. we have 'PATH' variable in the environment. when a command (say, 'dir' or 'sh' or 'ls', etc.) is executed, the shell first search for that executable file (i.e. dir / sh / ls) in the given paths in the variable 'PATH'. this is not available for the child commands of jvm. hence the basic commands are searched in the current directory of the jvm and they are failed.
    i solved the problem giving full path of the commands. like :
    p = rt.exec("/bin/sh runningScript.ksh")

  • Is there a keyboard shortcut to abort a running Automator app

    I have ceated an automator app that takes control of the mouse and does a couple of things with it. A couple of times, for different reasons I would have loved to have been able to abort my automator app.
    Is there a keyboard short cut that can do that? I have tried ESC without success.
    While the automator app is running a liitle cog appears on the menu bar. If I'm quick enough and the mouse is still for long enough, I can click on that cog and that has an option to kill the app, so the functionality is there.
    Thanks.

    Hi fane_j, thanks for the answer.
    I don't know, it must be old age, why did'nt I think of Automator Help???
    And you were right, the shortcut doesn't work in practice. How did you know that would be the case? Is Automator known to be a bit of a dud app?
    Its not what I'd have expected, as I said the "Stop" fetaure of the cog in the menu bar works great (so long as the mouse isn't moving around uncontrollably). Ya'd think the shortcut would work the exact same.
    Whats that ⎋ key. I don't seem to have it on my keyboard. (It looks like the time machine menu bar icon) Perhaps that may work?

  • Error while running the initialize service to create a new application

    Hi,
    I tried running the initialze service,when I encountered this error.Can anyone help me whith this.
    Setting EAC provisioning and performing initial setup...
    [03.20.13 23:32:37] INFO: Checking definition from AppConfig.xml against existing EAC provisioning.
    [03.20.13 23:32:38] INFO: Setting definition for application 'Endeca'.
    [03.20.13 23:32:38] INFO: Setting definition for host 'AuthoringMDEXHost'.
    [03.20.13 23:32:39] INFO: Setting definition for host 'LiveMDEXHostA'.
    [03.20.13 23:32:39] INFO: Setting definition for host 'ReportGenerationHost'.
    [03.20.13 23:32:39] INFO: Setting definition for host 'WorkbenchHost'.
    [03.20.13 23:32:39] INFO: Setting definition for host 'ITLHost'.
    [03.20.13 23:32:40] INFO: Setting definition for component 'AuthoringDgraph'.
    [03.20.13 23:32:40] INFO: [AuthoringMDEXHost] Starting shell utility 'mkpath_dgidx-output'.
    [03.20.13 23:32:41] INFO: [AuthoringMDEXHost] Starting shell utility 'mkpath_forge-output'.
    [03.20.13 23:32:42] INFO: [AuthoringMDEXHost] Starting shell utility 'mkpath_cumulative-partials'.
    [03.20.13 23:32:44] INFO: [AuthoringMDEXHost] Starting shell utility 'mkpath_dgraph-config'.
    [03.20.13 23:32:45] INFO: [AuthoringMDEXHost] Starting shell utility 'mkpath_local-dgraph-input'.
    [03.20.13 23:32:46] INFO: [AuthoringMDEXHost] Starting shell utility 'mkpath_local-cumulative-partials'.
    [03.20.13 23:32:48] INFO: [AuthoringMDEXHost] Starting shell utility 'mkpath_local-dgraph-config'.
    [03.20.13 23:32:49] INFO: Setting definition for component 'DgraphA1'.
    [03.20.13 23:32:50] INFO: Setting definition for script 'PromoteAuthoringToLive'.
    [03.20.13 23:32:50] INFO: Setting definition for custom component 'WorkbenchManager'.
    [03.20.13 23:32:51] INFO: Updating provisioning for host 'ITLHost'.
    [03.20.13 23:32:51] INFO: Updating definition for host 'ITLHost'.
    [03.20.13 23:32:51] INFO: [ITLHost] Starting shell utility 'mkpath_temp'.
    [03.20.13 23:32:53] INFO: Setting definition for custom component 'IFCR'.
    [03.20.13 23:32:53] INFO: Updating provisioning for host 'ITLHost'.
    [03.20.13 23:32:53] INFO: Updating definition for host 'ITLHost'.
    [03.20.13 23:32:54] INFO: Setting definition for component 'LogServer'.
    [03.20.13 23:32:54] INFO: [ReportGenerationHost] Starting shell utility 'mkpath_input'.
    [03.20.13 23:32:56] INFO: Setting definition for script 'DaySoFarReports'.
    [03.20.13 23:32:56] INFO: Setting definition for script 'DailyReports'.
    [03.20.13 23:32:56] INFO: Setting definition for script 'WeeklyReports'.
    [03.20.13 23:32:57] INFO: Setting definition for script 'DaySoFarHtmlReports'.
    [03.20.13 23:32:57] INFO: Setting definition for script 'DailyHtmlReports'.
    [03.20.13 23:32:57] INFO: Setting definition for script 'WeeklyHtmlReports'.
    [03.20.13 23:32:57] INFO: Setting definition for component 'WeeklyReportGenerator'.
    [03.20.13 23:32:58] INFO: Setting definition for component 'DailyReportGenerator'.
    [03.20.13 23:32:58] INFO: Setting definition for component 'DaySoFarReportGenerator'.
    [03.20.13 23:32:59] INFO: Setting definition for component 'WeeklyHtmlReportGenerator'.
    [03.20.13 23:32:59] INFO: Setting definition for component 'DailyHtmlReportGenerator'.
    [03.20.13 23:33:00] INFO: Setting definition for component 'DaySoFarHtmlReportGenerator'.
    [03.20.13 23:33:00] INFO: Setting definition for script 'BaselineUpdate'.
    [03.20.13 23:33:00] INFO: Setting definition for script 'PartialUpdate'.
    [03.20.13 23:33:01] INFO: Setting definition for component 'Forge'.
    [03.20.13 23:33:01] INFO: [ITLHost] Starting shell utility 'mkpath_incoming'.
    [03.20.13 23:33:03] INFO: Setting definition for component 'PartialForge'.
    [03.20.13 23:33:03] INFO: [ITLHost] Starting shell utility 'mkpath_incoming'.
    [03.20.13 23:33:05] INFO: Setting definition for component 'Dgidx'.
    [03.20.13 23:33:05] INFO: Definition updated.
    [03.20.13 23:33:05] INFO: Provisioning site from prototype...
    [03.20.13 23:33:06] SEVERE: null
    Occurred while executing line 3 of valid BeanShell script:
    1|
    2|
    3| IFCR.provisionSite();
    4| WorkbenchManager.updateWsConfig();
    5|
    6|
    [03.20.13 23:33:06] SEVERE: Caught an exception while invoking method 'run' on object 'InitialSetup'. Releasing locks.
    Caused by java.lang.reflect.InvocationTargetException
    sun.reflect.NativeMethodAccessorImpl invoke0 - null
    Caused by com.endeca.soleng.eac.toolkit.exception.AppControlException
    com.endeca.soleng.eac.toolkit.script.Script runBeanShellScript - Error executing valid BeanShell script.
    Caused by java.lang.NullPointerException
    com.endeca.soleng.eac.toolkit.utility.IFCRUtility extractIfcrErrorMessage - null
    regards,
    Rahul

    Hi Ritwik,
    I got this error while running the initialze service . I checked the Dgidx log but there was no log generated as I'm still running the initialize service.
    I even checked the workbench port and hostname.Every thing looks fine.
    but im not able to login or see the workbench login web page whn i try to access it with the hostname:portnumber .
    Regards,
    Rahul

  • Can we run EXE file/ Another Java Program from Java Application? How?

    Can we run EXE file and another java program from java application?
    Thanks in advance

    Example running adobe acrobat
    String command = "C:\\Program Files\\Adobe\\Acrobat 5.0\\Reader\\AcroRd32.exe /t "+selectedDocument+" \\\\CONTROL\\HP LaserJet 4L";
    Runtime rn = Runtime.getRuntime();
    Process process = rn.exec(command);
    process.waitFor();rykk

  • How to Execute Power Shell Command From Windows Application.

    Hi All Experts,
    I want to execute power shell commands from my windows application.
    Is it possible ?
    Please let me know your comments..
    Thanks.

    I have not tried this, but apprently it is easy as in the sample pasted below. please see this article for more details
    http://geekswithblogs.net/Norgean/archive/2012/09/19/running-powershell-from-within-sharepoint.aspx.
    Let me know how it goes...
    public string RunPowershell(string powershellText, SPWeb web, string param1, string param2) {
    // Powershell ~= RunspaceFactory - i.e. Create a powershell context
    var runspace = RunspaceFactory.CreateRunspace();
    var resultString = new StringBuilder();
    try
    // load the SharePoint snapin - Note: you cannot do this in the script itself (i.e. add-pssnapin etc does not work)
    PSSnapInException snapInError;
    runspace.RunspaceConfiguration.AddPSSnapIn("Microsoft.SharePoint.PowerShell", out snapInError);
    runspace.Open();
    // set a web variable.
    runspace.SessionStateProxy.SetVariable("webContext", web);
    // and some user defined parameters
    runspace.SessionStateProxy.SetVariable("param1", param1);
    runspace.SessionStateProxy.SetVariable("param2", param2);
    var pipeline = runspace.CreatePipeline();
    pipeline.Commands.AddScript(powershellText);
    // add a "return" variable
    pipeline.Commands.Add("Out-String");
    // execute!
    var results = pipeline.Invoke();
    // convert the script result into a single string
    foreach (PSObject obj in results)
    resultString.AppendLine(obj.ToString());
    finally
    // close the runspace
    runspace.Close();
    // consider logging the result. Or something.
    return resultString.ToString();
    Ok. We've written some code. Let us test it.
    var runner = new PowershellRunner();
    runner.RunPowershellScript(@"
    $web = Get-SPWeb 'http://server/web' # or $webContext
    $web.Title = $param1
    $web.Update()
    $web.Dispose()
    ", null, "New title", "not used");
    -Sangeetha

  • Need to run VI on boot or call from other application

    I am looking for the most basic way to get Labview to run a VI upon bootup or call from another application (without having to hit the run button on the toolbar.) I would rather not have to build an application; I don't want to buy the professional version. I want my data acquisition to recover from a power outage reboot and keep going without human intervention. Is there a way to build an init that launches the VI in run mode? A colleague of mine has convinced me labview is the way to go for a new experiment, but this is one stumbling block that needs to be resolved. Thanks for any help you can give.

    i have used the startup folder to run labview vi's on several machines and it *can* work just fine.
    however, sometimes there is a timimg problem and i get the message 'vi not found,' then labview usually loads the vi and runs - but leaves the error message, which can cause problems with later operations.
    today i had this problem with a 3.4 G HP machine running Win200. Labview 7.1 & DAQmx.
    my work around solution is to use the *MarcroScheduler* program. i call a it from the startup folder. it does the following
    (a) start Labview 7.1
    (b) wait 1 minute
    (c) execute the vi.
    without the wait state, Labview 7.1 will not run the vi properly.
    good luck with your applications.
    cu,
    larryb

  • How to execute any cmd command from java application?

    Hi all,
    How to execute or call any command of cmd from java application??
    Is there any method to do so??
    Or, is it possible to do it using Runtime.exec() ??? And if so, how to use it, please explain with ab example...
    I'll highly appreciate....
    Thank you.

    If google would be the best option, then I would not be on Sun's forums and I would not have asked experts like you, sir !! :-)
    Neway, I got the solution from PhHein !!
    Good link indeed..
    Cheers..

  • Running a db2 command from Java Application ??

    Hi All,
    I have to write an application in JDBC that can retrieve a list of databases on a db2 server, the only way I know is the db2 command "list database directory", but I can not use it in a JAVA program, is there a solution for this?
    Can anyone help me in this regard ?
    Thanks in Advance.

    If your driver implement it you can list databases with DatabaseMetaData
    Connection conn = ...
    DatabaseMetaData meta = conn.getMetaData();
    ResultSet rs = meta.getCatalogs();
    while (rs.next())
        System.out.println(rs.getString("TABLE_CAT"));
    }

  • Using Unix commands from Java Application

    Hi,
    I need to write an Java application such that could run Unix commands in a Unix box.
    For example, my Java app needs to log in the Unix box, change directory (cd), create new folder (mkdir), list the current files in folder (ls), mount a new device (mount), etc.
    Thank you very much.
    Hung

    you can use java.lang.Runtime.exec to invoke OS commands, but if you're going to be completing a sequence that complicated and need to manage error handleing well, it might be best to just invoke a native method or write a shell script that does all of that stuff and then invoke that script via Runtime.exec . The Runtime class has limitations when you start invoking processes that require user input (like 'su'). Search the forums for more extensive examples on how to use Runtime.

  • RemovePopUp command from parent application (not the popup).

    I am trying to remove a popup from the main application
    instead of the popup window. This way the window will close when
    they change tabs within the app or reclick the button. I can get it
    to close from within the popup with this statement just fine:
    PopUpManager.removePopUp(this).
    But shouldn't I be able to just use the same command with the
    object name to close it from the app itself, like this?
    PopUpManager.removePopUp(helpinfopop).
    I've searched this forum and Google and can't come up with
    anyone doing this. Everyone closes the popup from within the popup
    itself.
    private function showHelp():void {
    if(shHelp=="false"){
    shHelp="true";
    var helpinfopop:helpinfo =
    helpinfo(PopUpManager.createPopUp(this, helpinfo, false));
    helpinfopop.title="Help";
    helpinfopop.showCloseButton=true;
    helpinfopop.hscreen=allinfo.selectedChild.name;
    PopUpManager.centerPopUp(helpinfopop);
    else {
    shHelp="false";
    PopUpManager.removePopUp(helpinfopop);
    Thanks in advance.
    Chris

    Dmitri - Thanks for the help, but I'm still having some
    problems. I've tried the following two ways:
    private function showHelp():void {
    var helpinfopop:helpinfo; <------ MOVED IT UP
    if(shHelp=="false"){
    shHelp="true";
    helpinfo(PopUpManager.createPopUp(this, helpinfo, false));
    helpinfopop.title="Help";
    helpinfopop.showCloseButton=true;
    helpinfopop.hscreen=allinfo.selectedChild.name;
    PopUpManager.centerPopUp(helpinfopop);
    else {
    shHelp="false";
    PopUpManager.removePopUp(helpinfopop);
    public var helpinfopop:helpinfo; <----- MOVED IT UP AND
    OUT
    private function showHelp():void {
    if(shHelp=="false"){
    shHelp="true";
    helpinfo(PopUpManager.createPopUp(this, helpinfo, false));
    helpinfopop.title="Help";
    helpinfopop.showCloseButton=true;
    helpinfopop.hscreen=allinfo.selectedChild.name;
    PopUpManager.centerPopUp(helpinfopop);
    else {
    shHelp="false";
    PopUpManager.removePopUp(helpinfopop);
    In both scenarios, I get a new error stating that it "Cannot
    access a property or method of a null object reference." In both
    cases it is referencing the line: helpinfopop.title="Help".
    I'm assuming I'm doing something else wrong. I was really
    starting to get the hang of Flex. I've been using it for about 5
    months now. But apparently I'm missing something.....
    Thanks for the help so far. I look forward to your response.
    Chris

  • CMD commands from Java applications

    I have been searching around and trying to see if it is possible to open a DOS window (via cmd) and run a command (ie: ping, tracert) from a Java GUI. I not found anything as of yet. I am familiar with Runtime.exec(); but it does not seem to like cmd. I can launch other applications, but it does not seem to launch a command window at all, and if I add any other arguements it will give me an IO error.
    Anyone have any ideas?

    Read this:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    It'll tell you how to use Runtime.exec() properly. MOD

  • Execute DOS command from java application

    Hello,
    I want to execute a DOS command (MOVE, in order to move an image from a folder to an other) from a java application. How can I do this?
    Francesco

    Yes I have tested it and it is working but only when executing a bacth file. For instance:
    Runtime rt = Runtime.getRuntime();
    try{
         Process proc = rt.exec("move.bat");
    }catch(Exception ex){
         ex.printStackTrace();
    }and the command in move.bat is:
    move c:\\temp\\*.gif C:\\temp2
    You don't have to use double slashes in batch files, only in Java. But anyway it is working both ways.
    It is not working when you try to execute the command without the batch file:
    Process proc = rt.exec("move c:\\temp\\*.gif C:\\temp2"); -> this will not work.
    It should work. Try to execute another command to see what happens.

Maybe you are looking for

  • How can I get the Rockwell font in elements 11?

    Is there a way to add the rockwell font to elements 11?

  • Working with multiple buttons on a jsp form....!

    Hi guys...! I have a jsp form, which has 3 buttons (submit, update, cancel), and I also have a java Servlet that processes that form. In my java Servlet, i have a method called submitData(). I also want to have a method called updateData(), which wil

  • Is there a switch I can use with thunderbolt display and 2 computers

    I have the new Mac Mini and the new Macbook Air plus the 27 inch thunderbolt display.  The majority of the time, I will be using the thunderbolt display hooked up directly to the Mac Mini.   I have already tested the theory that if I turn off the Mac

  • How do I transfer my Wordperfect files to something compatible with an iMac

    I am considering getting an iMac for our office, but I have hundreds of wordperfect and quatropro files that I will still need to access. Since the Corel software is no longer available to run on iMacs, how do I open and save the files into whatever

  • RAM preview problem!!

    Hi guys & girls! My after effects will only render 12 sec +/-. Then it automaticlly starts the clip and when I press it again, Nothing happens. I tried downloading 5,5 & 6 & CC. I dont know if it is any problems with my RAM, maybe too much used? I wo