Page 1 of 1
perl language for moving the cursor
Posted: 2007-12-14 08:19:09
by Thomas C. Wolfe
What is the perl command for moving the cursor one space to the left and one space to the right?
Thnx
Posted: 2007-12-14 14:51:35
by martin
Perl itself cannot change the selection. You'll have to use a Nisus macro language command. Here's how to move the cursor one space to the right:
Code: Select all
$location = Selection Location
$location += 1 # add one to the location
Set Selection Location $location
If you have some Perl code that needs to calculate a more complicated selection location, just use the fact that variable values transfer across embedded Perl blocks:
Code: Select all
$location = Selection Location
Begin Perl
$location = ($location * 2) + 5;
End
Set Selection Location $location
thanks, and...
Posted: 2007-12-14 15:01:39
by Thomas C. Wolfe
and I suppose that
$location=Selection Location
location -=1
Set Location Location $location
means move cursor one space to the left?
Posted: 2007-12-14 16:02:10
by martin
Why not give it a try and see what happens? If you're writing macros you'll need to get comfortable with experimenting. It won't blow up your computer, I promise

There's also the macro language reference if you're looking for a list of commands/etc.
exactly!
Posted: 2007-12-15 10:11:57
by Thomas C. Wolfe
Thanks for this. Experiment is what I shall do!