How can you get STDIN input to a WSH script using cscript.exe? - wsh

I'm trying to use WSH in place of DOS/Batch files.
Thanks for the input!

Use WScript.StdIn
var input=WScript.StdIn.ReadLine();

Related

Inp(Abaqus) mesh file conversion into .msh file via meshio

I'm using meshio to convert an .inp mesh file into compatible form for Gmsh (.msh file type).Αlthough the conversion (meshio convert input.inp output.msh) generates a .msh file, Gmsh can't read it because it appears unusual characters. Please check the attached .pnj. Does anyone have an idea or even better a solution to fix it?
thanks in advance
output.msh file
I tried to convert the .msh output file into ascii but it did not workded

How do I start a bat file and enter a parameter?

I'm writing a rails application that needs to run a bat file and enter a password.
Tell me, how can this be done? Thank you!
The bat file:
SET JAVA_HOME=C:\javahome
if NOT DEFINED var (set /P var="password: ")
This answer should help you. That should work for Windows too.
Use Open3 like this:
output, status = Open3.capture2("script.bat", :stdin_data => my_secret_password)

Setting a file path as text to clipboard in LUA

I am a total noob to LUA.
I need a script that will just copy a file path as text to the clipboard. That's it. I absolutely cannot figure it out. I keep getting the error:
attempt to call a nil value (global 'set_clipboard')
Here is the file path I am trying to copy to the clipboard:
D:_Google Drive_Acting\VO\Room Tone\roomtone.wav
This must be a simple script, right?
For Windows you can do this:
filename = 'my_filename.txt'
io.popen('clip','w'):write(filename):close()
There is no built-in function for that.
In Mac OS, you can do this
function set_clipboard(text)
io.popen('pbcopy','w'):write(text):close()
end
Apparently, in Windows you can use clip instead of pbcopy. I don't know about Linux.

How to read a text file with ACE library

What is the easiest way to read a text file into an ACE_TCHAR* (or ACE_TString) ? is it possible to read a file with ACE_OS::read() or ACE_OS::fread()?
You can use regular ACE_OS::read(), see ACE_wrappers/examples/APG/Processes/Spawn.cpp, operation dumpRun()

Java 7 way to write a file

I have managed to read a file by
Files.copy(Paths.get(file.toURI()), System.out);
How do I write a sequence of characters to a file? I see no effect from
Files.copy(new ByteArrayInputStream(content.getBytes()), Paths.get(file.getName()))
and it looks ugly.
I have succeeded this way
Files.write(Paths.get(file.getName()), content.getBytes());

Resources