perl language for moving the cursor

Everything related to our flagship word processor.
Post Reply
Thomas C. Wolfe
Posts: 11
Joined: 2007-07-17 08:10:02

perl language for moving the cursor

Post 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
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Post 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
Thomas C. Wolfe
Posts: 11
Joined: 2007-07-17 08:10:02

thanks, and...

Post 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?
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Post 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.
Thomas C. Wolfe
Posts: 11
Joined: 2007-07-17 08:10:02

exactly!

Post by Thomas C. Wolfe »

Thanks for this. Experiment is what I shall do!
Post Reply