Shortcut to UltraEdit.outputWindow.write

Help with writing and running scripts

Shortcut to UltraEdit.outputWindow.write

Postby PJFromOverHere » Thu Oct 28, 2010 10:59 am

Since it's only used for debugging (or, at least for info to current UE user), I'd like to see a scriptable shortcut to UltraEdit.outputWindow.write.

And since it's a shortcut and meant for programmers, I propose this: ? (Yes, I'm a VBer)

In your code you just write:
? "this is the value of x now:" + x;

And, if the Output Window were used as an Immediate Window in the future it would still work and save space.

ALSO, why not, again since it's for debugging, make the syntax match the sprintf() function
? "this is our co-ordinates [%d,%d] and the next ones [%d,%d]\n", x,y,x2,y2;


ALSO, make sprintf part of the language. or, adopt String.Format() from .Net for the above, too (but that's not Javascript)
User avatar
PJFromOverHere
Newbie
 
Posts: 8
Joined: Wed Sep 26, 2007 11:00 pm

Re: Shortcut to UltraEdit.outputWindow.write

Postby bulgrien » Thu Oct 28, 2010 3:42 pm

First of all, as specified at the top of every page, this is a user-to-user forum which is not monitored by IDM. All suggestions and feature requests should be emailed directly to IDM. Regarding your suggestion to adopt the String.Format() from .Net, keep in mind that although the IDM development team does use Visual Studio 2008 as their IDE, UltraEdit is written in old-school C++ (API calls without leveraging the Microsoft Foundation Class wizards or the .NET framework available in Visual Studio). The goal is to retain the performance advantages of C++ (avoiding the overhead of calling the common runtime libraries) and to maintain compatability with older Windows operating systems.
User avatar
bulgrien
Master
Master
 
Posts: 92
Joined: Fri Dec 11, 2009 1:02 am
Location: Pennsylvania, USA

Re: Shortcut to UltraEdit.outputWindow.write

Postby jorrasdk » Fri Oct 29, 2010 2:45 am

It is not only used for debugging. I use the output window for informational data about programs or datasets.

I frequently create shortcuts for the output window like:
Code: Select all
function log (logmsg) { UltraEdit.outputWindow.write(logmsg); }
...
log("this is the value of x now:" + x);


The string formatting part is really more a language issue, than an UltraEdit API issue. I agree javascript could use a face lift of its string object functions.

But why not find a decent sprintf javascript function released to the public domain like http://www.diveintojavascript.com/projects/javascript-sprintf and save it as a file in your UltraEdit script folder.

It is not as convenient as what you describe but you will still able to write
Code: Select all
// include <path to your ultraedit script files>/function-sprintf.js
function log (logmsg) { UltraEdit.outputWindow.write(logmsg); }
...
log( sprintf("this is our co-ordinates [%d,%d] and the next ones [%d,%d]", x,y,x2,y2) );


But as bulgrien advices please feel free to send your feature request to IDM - you never know.
User avatar
jorrasdk
Master
Master
 
Posts: 275
Joined: Mon Mar 19, 2007 11:00 pm
Location: Denmark


Return to Scripts