Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - alex

#1
Run a newLISP script from a Windows .js file without console window.

Full version:
; // Posted by alex from newlisp.org
; var ScriptName = WScript.ScriptFullName;
; var App = "newlisp.exe " + ScriptName;
; var objArgs = WScript.Arguments;
; for (i = 0; i < objArgs.length; i++) { App = App +" "" + objArgs(i) + """; }
; var oShell = WScript.CreateObject ("Wscript.Shell");
; oShell.Run(App, 0, false); /*
# begin newlisp-program
(device (open "Hello!.txt" "write"))
(print "Hello!")
(close (device))
(exit)
# end newlisp-program
; */


Short version:
; // Posted by alex from newlisp.org
; var A = "newlisp.exe " + WScript.ScriptFullName; var R = WScript.Arguments; for (i = 0; i < R.length; i++) { A = A +" "" + R(i) + """; }; WScript.CreateObject("Wscript.Shell").Run(A, 0, false); /*
# begin newlisp-program
(device (open "Hello!.txt" "write"))
(print "Hello!")
(close (device))
(exit)
# end newlisp-program
; */


Tested in Windows7, but must work(I think) with Windows2000 and later.
#2
newLISP and the O.S. / Re: Windows install
May 08, 2014, 08:59:29 AM
Part of answer can be in http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=9&t=4135&p=20500#p20500">//http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=9&t=4135&p=20500#p20500



See environment variables!
#3
It may be interesting variant : http://code.google.com/p/conemu-maximus5/wiki/ConEmu">//http://code.google.com/p/conemu-maximus5/wiki/ConEmu

With support  "xterm 256 color mode" :-)

Your opinion?
#4
2 Maurizio:

see http://newlispfanclub.alh.net/forum/viewtopic.php?f=9&t=4135&p=20500#p20500">http://newlispfanclub.alh.net/forum/vie ... 500#p20500">http://newlispfanclub.alh.net/forum/viewtopic.php?f=9&t=4135&p=20500#p20500

Is it enough?
#5
I know one of variants now.

I install jre-6u32-windows-i586.exe to directory c:...javajre6 on my computer with Windows XP(32) OS.

I copy directory jre6 to q:testjre6 on my flashcard q:.

I uninstall JRE from my computer with Windows XP(32) OS.

I copy directory "newlisp" to q:testnewlisp on my flashcard q:.

I create file q:testnewlisp-edit.cmd:@set NEWLISPDIR=%~dp0newlisp
@set JRE=%~dp0jre6
@set path=%NEWLISPDIR%;%JRE%bin;%path%
@javaw.exe -jar %NEWLISPDIR%/guiserver.jar 47011 %NEWLISPDIR%/newlisp-edit.lsp /local/newLISPsplash.png
And I create file q:testrun-guiserver-demo.cmd: @set NEWLISPDIR=%~dp0newlisp
@set JRE=%~dp0jre6
@set path=%NEWLISPDIR%;%JRE%bin;%path%
@javaw.exe -jar %NEWLISPDIR%/guiserver.jar 47011 %~f1

Now I can run newlisp-editor  on any computer with OS >=WindowsXP from my flashcard by run .....testnewlisp-edit.cmd



Now I can open two explorer-windows

1: .....testnewlispguiserver,

2: .....test

and use "drug&drop" to run any guiserver-demo.lsp-file, by drugging the file to .....testrun-guiserver-demo.cmd icon



Now I can move my directory "test" to any computer with OS>=WindowsXP and the algorithm (run newlip-editor and guiserver-demo-files) will be the same :-)
#6
Our friend Maurizio ask interesting question (http://newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4119">http://newlispfanclub.alh.net/forum/vie ... =16&t=4119">http://newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4119)

The question is interesting for me too.

I read Lutz answer, but it is not enough for Windows-OS.

If I have no installed JavaVM(it can be a lot of reason), how I can run newlisp-edit.lsp?

If You have answer, tell, please :-)
#7
It can be only part of answer to your question, but problem with environment variable can be decided.

Place file MyNewLisp.cmd to the same directory, that newlisp.exe and run it.



MyNewLisp.cmd

@set NEWLISPDIR=%~dp0
@set NEWLISPDIR=%NEWLISPDIR:\=%
@%NEWLISPDIR%newlisp.exe
#8
Thanks xytroxon, Your variant is best now!
#9
All o'k, thank You Lutz!
#10
I am sorry, smile is bad. I will correct...
#11
only .cmd - not .bat
#12
Run a newLISP code as ".cmd"-file(Windows 2000 and more)

@rem Posted by alex from newlisp.org
@newlisp.exe "%~f0" %* & goto :EOF
# begin newlisp-program
(println "Hello World!")
(exit)
# end newlisp-program
#13
I don't knew, who tuning "Code Snippets", but, please, correct first string and specify, that extension of batch-file MUST be ".cmd"
#14
2 xytroxon

It was good variant, when I used Win2k and Win98 together. New variant is simpler, I think.
#15
For Windows 2000 and more You can add ONLY ONE short string before newLISP text.

Example:

file HelloWorld.cmd contain

@newlisp.exe %0 %* & goto :EOF
# begin newlisp-program
(println "Hello World!")
(exit)
# end newlisp-program
:-)



Correction 2012.02.21

First string must be
@newlisp.exe "%~f0" %* & goto :EOF

Such variant allow run HelloWorld.cmd from command line without extention ".cmd", and fix problem, when full path to HelloWorld.cmd contain spaces.