alt+pgup/pgdn to scroll one screen left/right

Help with writing and playing macros

alt+pgup/pgdn to scroll one screen left/right

Postby uetrtr » Wed Nov 26, 2008 2:51 am

Oops, i see now this is a user-to-user forum. But if somebody knows how to achieve this myself, just let me know -tks!
========
It would be great if you could add this keyboard shortcut just like ms excel has.
Then one won't have to go searching with the mouse, for where to click on the panes.
Thanks for the great app.
uetrtr
Newbie
 
Posts: 4
Joined: Wed Nov 26, 2008 2:49 am

Re: alt+pgup/pgdn to scroll one screen left/right

Postby Mofi » Thu Nov 27, 2008 10:18 am

What about using soft word-wrap on window border? Then you would not need to scroll left/right anymore.

You could write 2 scripts called by the hot keys you like to move the cursor in the current line +80 columns or -80 columns if possible. That's not exactly what you want, but maybe a good workaround.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: alt+pgup/pgdn to scroll one screen left/right

Postby uetrtr » Fri Nov 28, 2008 2:12 am

Hi, thanks for the tip! Excuse my ignorance, but could you tell me where to start, if I want to do like you say.
(Greetings from R of SA...)
T
uetrtr
Newbie
 
Posts: 4
Joined: Wed Nov 26, 2008 2:49 am

Re: alt+pgup/pgdn to scroll one screen left/right

Postby Mofi » Fri Nov 28, 2008 8:20 am

uetrtr wrote:But could you tell me where to start

Start with what, using soft word-wrap or writing the scripts?
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: alt+pgup/pgdn to scroll one screen left/right

Postby uetrtr » Fri Nov 28, 2008 10:01 am

I assume you mean something like:
Create a macro.
Edit its script to e.g. go to row=x, col=y where:
x = current row i.e. unchanged
y = current col + 100 say.
This will in effect scroll to the right hand side.
There is a script command 'gotoline'.
But it always defaults to 'gotoline X' when I save the macro, even if I enter say 'gotoLine X/Y' in the script.

In other words: I cannot get it to go to column Y.

Can you help?
uetrtr
Newbie
 
Posts: 4
Joined: Wed Nov 26, 2008 2:49 am

Re: alt+pgup/pgdn to scroll one screen left/right

Postby Mofi » Sat Nov 29, 2008 5:34 am

No, I have not meant to use a macro. I have written about using scripts. The macro environment offers no method to get current column number and add or subtract a fixed value, but the script environment does. Here are the 2 scripts. You have to copy each of them into a separate *.js file:

Code: Select all
// Script to move the cursor x columns to left - move window left.
UltraEdit.outputWindow.showStatus=false;
if(UltraEdit.document.length > 0) {
   var Column = UltraEdit.activeDocument.currentColumnNum;
   if (typeof(UltraEdit.activeDocumentIdx) == "undefined") Column++;
   if(Column > 100) Column -= 100;
   else Column = 1;
   UltraEdit.activeDocument.gotoLine(0,Column);
}


// Script to move the cursor x columns to right - move window right.
UltraEdit.outputWindow.showStatus=false;
if(UltraEdit.document.length > 0) {
   var Column = UltraEdit.activeDocument.currentColumnNum;
   if (typeof(UltraEdit.activeDocumentIdx) == "undefined") Column++;
   /* First move the cursor 200 columns to right to force
      a complete horizontal scroll of the active window. */
   UltraEdit.activeDocument.gotoLine(0,Column + 200);
   // Next set the cursor to the really wanted position.
   UltraEdit.activeDocument.gotoLine(0,Column + 100);
}


Unfortunately the simple and fast script solution has one big disadvantage - by default when running a script a status message is written into the output window overwritting existing output window content. So maybe 2 macros are really better and I have had also an idea how to code it.

Macro to move the cursor x columns to left - move window left:

Loop 100
IfColNum 1
ExitLoop
Else
Key LEFT ARROW
EndIf
EndLoop


I have named above macro "Window Left" which is important because this macro is used also in the second macro.

Macro to move the cursor x columns to right - move window right:

Loop 200
IfCharIs 13
ExitLoop
Else
IfCharIs 10
ExitLoop
Else
Key RIGHT ARROW
EndIf
EndIf
EndLoop
PlayMacro 1 "Window Left"


The macro name is case-sensitive!
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: alt+pgup/pgdn to scroll one screen left/right

Postby uetrtr » Mon Dec 01, 2008 2:29 am

Wow, looks extremely promising - this can open up a new avenue in my use of UE! Will try it when I have time (boss keeps looking over my shoulder...) Your help is [extremely] much appreciated! Best regards
uetrtr
Newbie
 
Posts: 4
Joined: Wed Nov 26, 2008 2:49 am


Return to Macros