Author Topic: defeated by basic batch macro: Command not allowed when no edit windows present  (Read 4807 times)

jbarriewalker

  • Community Member
  • Posts: 16
  • Hero Points: 0
I can't see what I've missed.
I've copied the example to a file called /tmp/xxxx.e containing:

Code: [Select]
#include "slick.sh"

defmain()
{
   messageNwait("Arguments given: "arg(1));
   parse arg(1) with word1 word2 .;
   messageNwait("word1="word1" word2="word2);
   return(0);
}

I bring up the command-line and run "/tmp/xxxx hello"
and I get a dialog box saying "Command not allowed when no edit windows present"

Doesn't seem too much to ask.

Any ideas?

MartyL

  • Senior Community Member
  • Posts: 161
  • Hero Points: 26
  • Synergex Software Engineer
All that I can figure is that messageNwait() can't be run if the editor window hasn't been loaded.

Your batch macro is getting run before the environment has been fully loaded (or even prior to anything being loaded). You could store an environment variable then run something else after the environment is loaded to retrieve the data.

hs2

  • Senior Community Member
  • Posts: 2736
  • Hero Points: 288
You could also try
Code: [Select]
/**
 * Write a string to the SlickEdit log file.
 * The log file is named "vs.log" and is located in the
 * user's configuration directory.
 *
 * @param string     string to display
 */
void dsay(_str string);
HS2

Graeme

  • Senior Community Member
  • Posts: 2268
  • Hero Points: 292
I can't see what I've missed.
I've copied the example to a file called /tmp/xxxx.e containing:

Code: [Select]
#include "slick.sh"

defmain()
{
   messageNwait("Arguments given: "arg(1));
   parse arg(1) with word1 word2 .;
   messageNwait("word1="word1" word2="word2);
   return(0);
}

I bring up the command-line and run "/tmp/xxxx hello"
and I get a dialog box saying "Command not allowed when no edit windows present"

Doesn't seem too much to ask.

Any ideas?


Your batch macro works for me.  What version of slick and OS are you using.

Do you get an xxxx.ex file built in the /tmp folder when you run the batch macro?
When you say you've "copied the example" - what example are you referring to?

Try adding the drive at the start of /tmp/xxx  e.g. c:/tmp

I assume when you run the macro
Quote
I bring up the command-line and run "/tmp/xxxx hello"
that you don't actually type the quotes on the command line?

If you add "void" before defmain, do you get an error "void function cannot return a value" or something?

Graeme



Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4616
  • Hero Points: 367
Forward slash is interpreted as the find command (i.e /findthis/wxcs) .  On Unix, you need to type "xcom /tmp/xxxx hello".

jbarriewalker

  • Community Member
  • Posts: 16
  • Hero Points: 0
Thanks for all the replies.
I'm running version 12 on Redhat 4.5 Linux.

xcom proved to be the missing link, although I needed dsay to show that it's working from an external command line
and xxxx.ex now gets created!

Thank you all