Gnuplot 5.2 does not load script file - windows-7

I use Gnuplot in windows 7 in terminal wxt to plot several 2-d plots from a data file with 5 columns of time data. Plotting works fine with a simple script file gvx.dat, which is invoked by the command prompt gnuplot: load "gvx.dat". When using an other script file, then an error comes: Cannot open script file 'ddd.dat'. This occurs with every script file, even with a copy gvx-copy.dat of gvx.dat, where the compare command fc indicates no difference between gvx.dat and gvx-copy.dat.
Any idea why it does not work?

and thanks for your answer.
In gnuplot console after pwd we have C:\gnuplot\bin where gnuplot.exe is.
Path of the two script files is as given in the script file, see below.
The script file is:
set terminal wxt
cd '..\..\..\R:\neue-dateien\fam\2012\fortranprogramme'
pwd
set title ' Geschwindigkeit über Weg'
set yrange [0:1]
set xrange [0:720]
set xlabel 'Entfernung [km]'
set ylabel 'Geschwindigkeit [%c]'
plot 'bislins.dat' using 5:1 with points
For me it seems, that one year ago, I used the same data and scripts and they worked well. May be the misbehavior is cause by any change in windows stuff??
Does this help?

My understanding of your problem:
You are typing load gvx.dat in the gnuplot console with the initial working directory (as you say it is C:\gnuplot\bin). But in this script you are changing the directory to something else. So, after this script has finished, and if you type load gvx.dat again, it will not be able to find it because now you are in a different directory.
You could give the absolute path to your file, e.g.:
set terminal wxt
FILE = 'R:\neue-dateien\fam\2012\fortranprogramme\bislins.dat'
set title ' Geschwindigkeit über Weg'
set yrange [0:1]
set xrange [0:720]
set xlabel 'Entfernung [km]'
set ylabel 'Geschwindigkeit [%c]'
plot FILE using 5:1 with points

I tried this with a line FILE= in the script, but it did not work. The main problem is, that no other script file can be loaded, except gvx.dat. If I start gnuplot with a copy of gvx.dat or any other script file in the same directory, the error comes : cannot open script file.
SoI have copied the scripts and the data file into the installation directory C:\gnuplot\bin and now it works. I cannot realize the solution to this problem, gnuplot cannot find the correct directories or if the script file gvx.dat is such unique and all others are wrong in an invisible way. Any way, I can live with it, by using it inside the bin directory. Therefor I like to end the discussion, thanks for help to all guys!

Related

Export file to serve while evaluating Wolframscript through command line

I am trying to use a server to do a set of computations for me, and then export the results as a csv to the server to then be transferred to my own computer. I am having trouble exporting files by remotely running a script. I have a .nb file
a = 1;Export[Directory[] <> "/a.csv", a]
Then I transfer the file to the server and with wolframescript run the script:
$ wolframescript -script /location/filename.nb
I expect a file called a.csv to appear in the directory the .nb file is saved in yet it doesn't. I have tried -run and -file and none of them work either. I have also tried a .wl file and it also doesn't work. What am I doing wrong?
As far as I can tell, when using scripts, file operations are more primitive. Functions OpenWrite OpenAppend Write WriteString and Close are key. Options CharacterEncoding FormatType and PageWidth can help with string data / text files. Your example works on the Desktop with:
a = 1; pipeStream=OpenWrite["a.csv",FormatType->OutputForm]; Write[pipeStream,a]; Close[pipeStream]
Save as Wolframscript from Mathematica "name.wls". On Linux, you need to make the file executable see Wolfram Tutorial.
Then at your respective prompt > $ etc
Wolframscript -file name.wls
should run the script file and create a CSV file with the value "1".
This answer reminds that code generated in Mathematica intended for scripting requires Cells to be Initialization cells

Inkscape ungroup everything from windows command line

I converted a bunch of PDFs into individual SVGs for editing. The SVGs are named as the page numbers, so I have a whole folder of 001.svg, 002.svg ... and the problem is they all the objects in each SVG are grouped together and I have ungroup everything before I can edit the pages which takes a few minutes on each page.
Would save some time if I could ungroup all the pages from the command line first. I've looked at the inkscape command line options and maybe this is actually a windows command prompt or powershell question too because I'm not sure how to loop through files incrementally in either of those
I saw some question here for ungrouping from the command line with
inkscape --actions "select-all:groups; SelectionUnGroup; export-filename: output.svg; export-plain-svg; export-do;" intput.svg
But even trying that one individual files nothing happens, I did replace inkscape with the full path
Anyone know how to accomplish this? Thanks!
There should be an easier way by using the 'deep ungroup' Python script from the command line.
Unfortunately, I can only give you the syntax for Linux, so you need to adjust the paths and the '>' (which means 'output into the following file') to your Windows paths and PowerShell syntax.
With default extension settings, it works like so:
python3 /usr/share/inkscape/extensions/ungroup_deep.py groups.svg > ungrouped.svg
Alright I believe I have solved it. For some reason I don't think it's possible to do this using the "without-gui" flag which is unfortunate. But this is what I ended up using (still takes a few minutes per file, but doesn't require any work on my part"
I'm using Inkscape 0.92 for reference (I believe this would not work in later versions)
#echo off
for %%i in ("%~dp0*.svg") do (
echo %%i
"C:\Program Files\Inkscape\inkscape.exe" -f "%%i" --verb EditSelectAll --verb
SelectionUnGroup --verb FileSave --verb FileQuit
)

How to open a file from the command line with a specified program?

I would like to open a PDF in Photoshop from the command line. My current issue right now is that the default application for opening PDFs is Adobe Acrobat. I'm wondering if there is any parameter I can pass to specify which program to use when opening a file.
In other words, I want to emulate the option of "Open-with" when you right-click a file to open it with the non-default application, but from the command line.
I do not want to change the default application for PDFs to be Photoshop.
Any ideas?
All you need to is provide the filename as a command line argument:
photoshop <path to file>
(<path to file> needs to be quoted if it contains spaces)
For example:
photoshop "C:\Users\csterling\Documents\some document.pdf"
If the directory containing photoshop.exe isn't in your Path environment variable, you'll need to provide the full path:
"C:\Program Files\Adobe\Photoshop\photoshop" "C:\Users\csterling\Documents\some document.pdf"
This isn't a feature of the command prompt, it's a feature of the executable, i.e. photoshop.exe has to be programmed to accept a file to open as a command line argument. Fortunately, it is, as are the majority of Windows applications that operate on files.
In case you want this to work with relative path in PowerShell, here is the script:
function photo
{
$the_filename=resolve-path $args[0]
photoshop $the_filename
}
Then you can just type:
cd C:\Users\csterling\Documents
photo mypic.jpg
You can do it by using the start command:
start <program-name> <file-path>
In your case, you would have to do something like this:
start photoshop D:\open.pdf
Unfortunately, the current version of Photoshop doesn't support this operation out of the box. You can open the program: start "path_to_photoshop.exe", but there is no way to pass it a file to open. If you really want to do it, you will need to get something like this: https://www.eulanda.eu/en/access-photoshop-api-via-powershell-script. Sorry, I wish I had a better answer, especially since I wanted to be able to do this for a program I was working on.

VBS script (VBScript) errors 800A0035 and/or 800A004C only on the first execution of the script

I am pretty new to all this VBS stuff because basically all I need to do is to make one simple VBS script, which I have possibly written, however, my problem is that it gives me 800A0035 or 800A004C error when I execute it for the first time on a particular PC, as soon as I execute it for the second time, it runs just OK and does what it is supposed to do. Incidentally, on my own computer it works OK even on the first execution.
I know that the errors have something to do with the wrong paths but I have checked my script several times and I am 100% positive that they are correct.
Here is the script:
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "rar.bat" , "rarp.bat"
'HideBat.vbs
CreateObject("Wscript.Shell").Run "rarp.bat", 0, True
What the script is supposed to do is to rename the rar.bat file to rarp.bat and run that batch file (rarp.bat) without popping up the command prompt. What the batch file does is not relevant, I guess, but anyway, it just runs WinRAR.
The rar.bat file and the VBS script are in the same folder, that's why I have used relative paths in the script. I cannot use absolute paths because I need to run the script on several computers.
I have read somewhere on the internet that by default VBS script first looks for the files in C:\Windows\System32 when relative paths are used. I have even tried using absolute paths in the script but it didn't work either. Here is how I need them to look like: %systemdrive%\users\%username%\appdata\roaming\rar.bat but this simply didn't work in the VBS script.
I really think that what I need is really a simple script but apparently it's pretty hard to get it working properly. I will be very grateful to those who help me.
Thank you a lot in advance.
Regards.
The only way your script - at least the part published - can give an error is by not finding the source file for renaming, you should have added full script and error message to be sure.
I suppose this is caused by a security setting on your pc that are more forgiving than on the rest of the pc's, eg UAC ? On the other pc's, try to put the files in a map like c:\test and then run it again after checking that the file rar.bat does exist in the same map. Do you have the same credentials (admin) on the other pc's ?
If you just want to run the bat file hidden, why the renaming ?
how do you download the bat ? and how then is invoked the script ? could be a timing issue that the second time is no longer a problem. In that case check in your script if the file is allready there and do a sleep in a loop while it doesn't
If you want to use the absolute path you could try this
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
path = WshSysEnv("USERPROFILE") & "\appdata\roaming\rar.bat"
wscript.echo path
objFSO.MoveFile path , "rarp.bat"
CreateObject("Wscript.Shell").Run "rarp.bat", 1, True

How To Add A Script To Add Functionality To the Terminal?

I have a small perl script ( found here ) which adds command line functionality to an application I already have installed, Coda. Basically it will open a file with the application when I type:
coda filename.py
Where (on OSX) do I need to put this file to make it function? Do I need to do anything else to my environment to get this working?
Type echo $PATH at the terminal. You will get back a series of paths separated by colons. The file needs to be placed into one of those folders. The file also needs to have the execute flag set, which is done with the chmod tool.

Resources