When scripting a commandline utility, console.clear() and other console.*ã > functions are 'undefined' Is there a load(*.js) I need to call at the startã > of the script to has access to those functions or are they hard coded inã > sbbs?ããnevermind, I see that there is a conio.clrscr() and should be used withãconio.suspend(); to return conio for output/input from local onsole, duh!ããããããMy teachers always said "You can't make a living looking out a window!", theyãwere wrong, I drive truck :-Pãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Re: More dumb questionsã > By: Mortifis to All on Fri Jul 19 2019 11:18:34ãã > Mo> When scripting a commandline utility, console.clear() and otherã > Mo> console.* functions are 'undefined' Is there a load(*.js) I need toã > Mo> call at the start of the script to has access to those functions or areã > Mo> they hard coded in sbbs? ãã > 'console' only exists in scripts running in the 'bbs' context, ie. under aã > telnet/rlogin/ssh session. ã > Its methods are strictly for interacting with a remote terminal and theyã > aren't relevant under jsexec,ã > the webserver, or other places where Synchronet runs JS.ãã > There are ways to deal with running scripts either under jsexec or in a BBSã > session (you seemed to haveã > the idea of doing 'if (js.global.console)').ãã Ya, I see that now, I found conio.clrscr; and conio.suspend which does what Iãneeded. ãã > Sometimes it's just easier toã > pick one or the other. Thisã > script in particular (generating a report about dupe users) seems like aã > utility I'd just want to runã > under jsexec and I wouldn't need to run during an ssh session.ãã ã I was following the premise under mailall.js LOL but, with your help, I amãslowly seeing the error or my ways :-)ããThe script has already grown beyond an FYI script and is has menu optionsããThanks, ECããããMy teachers always said "You can't make a living looking out a window!", theyãwere wrong, I drive truck :-Pãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Re: More dumb questionsã > By: Mortifis to All on Fri Jul 19 2019 11:18:34ãã ãAnd yet another one, so when I say 'console' I am referring to running viaãjsexec in a terminal and optput is stdout ... how does one change font colorsãand the background color of an input ( readln() ) prompt?ããI'll owe you a case of beer after this ... :)ããããMy teachers always said "You can't make a living looking out a window!", theyãwere wrong, I drive truck :-Pãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Re: Re: More dumb questionsã > By: Mortifis to echicken on Fri Jul 19 2019 14:00:37ãã > Mo> And yet another one, so when I say 'console' I am referring to runningã > Mo> via jsexec in a terminal and optput is stdout ... how does one changeã > Mo> font colors and the background color of an input ( readln() ) prompt?ãã > I don't think any of the basic output methods have any provisions for doingã > magic colour stuff, so you'dã > probably have to send escape sequences yourself. It's possible that we haveã > some JS libraries that mightã > help with that, but I'd have to look (and it's more likely that they rely onã > stuff that the consoleã > object already does).ããI see conio.textcolor and conio.textbackground but I am unsure how to use itã... I tried conio.textcolor=3 but it displays jibberish and completely hosesãthe outputããããMy teachers always said "You can't make a living looking out a window!", theyãwere wrong, I drive truck :-Pãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Re: Re: More dumb questionsã > By: Mortifis to echicken on Fri Jul 19 2019 16:33:27ãã > Mo> I see conio.textcolor and conio.textbackground but I am unsure how toã > Mo> use it ... I tried conio.textcolor=3 but it displays jibberish andã > Mo> completely hoses the outputãã > I completely forgot that thing existed. Can't remember ever using it,ã > though.ãã > I would imagine that if you want to use it for i/o, you should use itsã > methods and no others.ãã > I just whipped up this quick test and it seemed to do what I expected:ãã > conio.init();ã > conio.clrscr();ã > conio.textcolor = 14;ã > conio.cputs('hihi');ã > conio.getch();ããthat hoses the stdout the same, oh well, colors are, technically, unnecessary,ãthank you, might be a Windows thing.ããI have a basic script dup_user_checker.js that takes argv's and allows userãediting ... would it be possible to upload (or have it uploaded) to the cvs /ãexec/examples directory?ãããããMy teachers always said "You can't make a living looking out a window!", theyãwere wrong, I drive truck :-Pãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Sysop: | Karloch |
---|---|
Location: | Madrid, Spain |
Users: | 54 |
Nodes: | 8 (0 / 8) |
Uptime: | 129:26:31 |
Calls: | 700 |
Files: | 17,895 |
D/L today: |
128 files (60,769K bytes) |
Messages: | 66,010 |