photools.com Community

IMatch Discussion Boards => IMatch Scripting and Apps => Topic started by: Carlo Didier on November 07, 2018, 03:10:39 PM

Title: shellExecute
Post by: Carlo Didier on November 07, 2018, 03:10:39 PM
Any ideas why this just won't work? I also tried with the full path to Notepad.exe.

All it does is output the content of strCommandLine, but it doesn't start Notepad.

Same with anything I tried. Just nothing happens. No errors, no other output, nothing at all.
<script>
    strCommandLine = 'notepad.exe';
    console.log(strCommandLine);
    shellExecute(strCommandLine);
</script>
Title: Re: shellExecute
Post by: Mario on November 07, 2018, 03:16:17 PM
shellExecute is not a built-in JavaScript command. This functionality is provided by IMatch via an endpoint.

Please refer to the sample app "Processes" which shows how to launch Windows Notepad. This app is included in IMatch.
It uses the following code:

IMatch.shellExecute({
    'verb' : 'open',
    'executable' : 'notepad.exe'
}).then(function(response) {



You need to include jQuery and the IMatchHelp wrapper class in your index.html.

See C:\ProgramData\photools.com\IMatch6\webroot\imatch\samples\process\index.html

The documentation for shellExecute is here: https://www.photools.com/dev-center/doc/imatch/IMatch.html  This page also has several examples for how to use this method.
Title: Re: shellExecute
Post by: JohnZeman on November 07, 2018, 03:37:34 PM
Carlo if it helps here is a snippet from one of my apps where I run an external command script.  Note the escaped \ in the full path of the script file name.

      // CHECK MATCHING IMAGES FOR REPROCESSED JPGS CMD SCRIPT ////////////////////////////////////
      $('#btn-check').click(function() {
         IMatch.shellExecute({
            'executable': 'D:\\Mine\\cmd\\Reprocessed Photo Match for JPGs Check.cmd',
            'verb': 'open',
            'showwindow': true
         });
      });
      /////////////////////////////////////////////////////////////////////////////////////////////
Title: Re: shellExecute
Post by: Carlo Didier on November 07, 2018, 03:50:20 PM
Quote from: Mario on November 07, 2018, 03:16:17 PM
IMatch.shellExecute({
    'verb' : 'open',
    'executable' : 'notepad.exe'
}).then(function(response) {



That works! Thanks!