What's the difference between SendKeys "{SPACE}" and Sendkeys " "? - naturallyspeaking

What's the difference between those two Advanced Scripting commands?
Sub Main
  SendKeys "{SPACE}"
End Sub
and
Sub Main
  SendKeys " "
End Sub

http://www.speechcomputing.com/node/8053:
Basically, there is no difference. Both do the same thing.

Related

What is the equivalent of this step-by-step voice command in advanced scripting?

I defined a step-by-step voice command:
What is the equivalent of this step-by-step voice command in advanced scripting?
I tried:
Sub Main
SendKeys "^{Pad4}"
End Sub
and
Sub Main
SendSystemKeys "{Ctrl}({NumKey4})"
End Sub
and
Sub Main
SendSystemKeys "^{NumKey4}"
End Sub
None of them works.
Sub Main
SendSystemKeys "{Ctrl+NumKey4}"
End Sub
There may be other variants that work depending on the language of your OS and Windows version. If the above does not work, try this:
Sub Main
SendSystemKeys "{Ctrl+Num4}"
End Sub
You can only use the ^ for Ctrl with SendKeys. SendSystemKeys & SendDragonKeys need the full form (Ctrl).

How to run a perl script from another passing parameters?

How to run a perl script from another passing parameters?
I'm trying to use a solution found in a internet post that i can't find anymore.
It was something like:
do 'script.cgi param1 param2';
And in the other script I'm using simply the shift to get those parameters:
#Parameters
my $param1= shift;
my $param2= shift;
I saw people using system with args, but is it better for real?
If not, how can I fix the solution with 'do EXPR'?
Thanks in advance.
Oh well, I solved doing:
{local #ARGV = (#my_args); do $script;}
It works. If anybody has any better suggestions feel free to tell them to me.
Meantime i'm using this solution.
Actually, there are two better ways I can think of:
system($script, #my_args);
and
my $cmd = $script . ' ' . join(' ', #my_args);
my $return = `$cmd`;
Both solutions pass the arguments in #my_args. The system() call returns the exit code of the executed program, while the backticks solution (``) returns the output for later parsing.

When reading input from the user in Perl, how to let Perl not display "Terminating on signal SIGINT(2)"?

I'm very new to Perl and currently I'm learning it on Windows 7 with ActiveState Perl. This is my program.
chomp(my #lines = <STDIN>);
foreach (sort #lines) {
print $_;
}
When running the program, I type some lines of strings then press Ctrl + c to tell the program that I've finished typing. However, after I get my result (generated from print $_;), I also got this message: Terminating on signal SIGINT(2). How to disable this message?
Thanks.
For Windows, to signify End of Line press Ctrl + Z followed by Enter
Pressing Ctrl + C sends the interrupt signal to your program which is the cause of the Terminating on SIGINT message you are seeing.
In Linux, press ctrl + D (EOF) instead of ctrl+C
You can handle signals like that:
$SIG{INT} = sub { print("Caught SIGINT but continue!\n"); };
for a keyboard interrupt. It's an exemple.

Print the return of a method

I know in php I can do something like this
echo "{$this->method}";
and I swear there was a way to do it in perl
Update:
What I am trying to do is print a scalar that the method returns. I was kind of hoping of doing within the string like in php, just because I'm lazy :P.
Are you just trying to evaluate an arbitrary expression inside a double quoted string? Then maybe you're thinking of
print "#{[$this->method]}";
There is also a trick to call the method in scalar context, but the syntax is a little less clean.
print "${\($this->method)}";
Well, if $this->method outputs a string or a number (like PHP, Perl can automatically convert numbers to strings when required), then you can do print $this->method . "\n";.
If $this->method outputs a data structure (eg an array reference or a hash reference), you can use Data::Dumper to look at the structure of the data. Basically, print Dumper($foo) is the Perl equivalent of PHP's var_dump($foo).
What are you trying to do, exactly?
If $this->method is returning a string, you can do this:
print $this->method . "\n";
without quotes. That will print your string. Sometimes, that can lead to a clumsy looking statement:
print "And we have " . $this->method . " and " . $that->method . " and " . $there->method . "\n";
In that case you can use a little programming trick of:
print "And we have #{[$this->method]} and #{[that->method]} and #{[$their->method]}\n";
Surrounding a function with #{[]} prints out the function's value. Someone explained this to me once, but I can't remember why it works.

How can I trap Cntl-C while using Perl's Term::ShellUI?

I used Term::ShellUI and almost every thing
is working as expected but the issue is when I pressed Ctrl-C I want to
print:
Please use ctrl+d to exit the shell
For that I handle the signal but the message print only after I pressed the new line
How to resolve this?
You can do the same without using the IO::Handle library, by setting the $| variable to 1 before printing.
$SIG{INT} = sub {
$| = 1;
print "Please use ctrl+d to exit the shell";
}