Error with ko.run.runEncodedCommand

Hi, help wanted!

Each time when I insert more than one ko.run.runEncodedCommand statement in a single macro, I get the error message:

example code:

ko.run.runEncodedCommand(window, 'echo off');
ko.run.runEncodedCommand(window, 'echo on');

error:
A previous command is currentl y running in the Command Output tab. That command must finish before staring another.

What’s wrong? Thanks!

What exactly are you trying to accomplish? That’s a normal response to trying to run a command in the output pane when one is already running.

  • Carey

Hi @careyh

Fro example, I have a script to treat all html files in C:\myWorkplace.

var file = FileUtils.getDir("DfltDwnld", ["myTemp"], true);
var entries = file.directoryEntries;

while(entries.hasMoreElements()) {
   var entry = entries.getNext();
   entry.QueryInterface(Components.interfaces.nsIFile);   
   var myOutput = "C:\\myOutput\\" + entry.leafName;
   ...
}

Because I can’t figure out how to go through files in C:\myWorkplace\, ( “DfltDwnld” can’t be replaced with "C:\\myWorkplace\\"! This is another question I want to ask!!), I need to move all html files in C:\myWorkplace\ first to System\Download\myTemp\, treat them, and then delete all of them. Therefore I need to run at least two outside Windows commands (Move and Delete) in the singe Komodo script, and get the error.

Thank you for your help!

Hi @careyh Looking forward to your comments. Thanks!

@surfactant,

There are a couple options I think but I think the easiest would be to use require("ko/shell") to run the copy and delete commands instead of whatever you’re using that is dumping it’s output to the Output console:
http://docs.activestate.com/komodo/12/sdk/api/module-ko_shell.html

  • Carey
1 Like

Hi @careyh Thank you for your direction!

1 Like