| <<<Back 1 day (to 2016/07/25) | 20160726 |
^Simon^_ | Hi, I'm using the windows version of ghostscript 9.19 and have a few questions. | 13:22.21 |
| Is there any way to paste ghostscript into the interactive window? | 13:22.44 |
kens | Paste 'ghostscript' ? | 13:23.01 |
^Simon^_ | or is it best to edit a file and somehow load the file? | 13:23.05 |
kens | Ghostscript is the application name | 13:23.11 |
^Simon^_ | sorry, postscript commands. | 13:23.17 |
kens | Aha | 13:23.20 |
| THen no, you cna't paste, just type | 13:23.26 |
chrisl | Might be better using the console app | 13:23.37 |
kens | THat can't do paste eitehr :-) | 13:23.51 |
chrisl | You can paste into the console window | 13:24.05 |
kens | Really ? I had no idea | 13:24.57 |
^Simon^_ | as in open a command prompt and run something there? | 13:25.37 |
kens | The console app runs in the command shell | 13:25.55 |
chrisl | So the exe is gswin32/64c.exe | 13:26.13 |
^Simon^_ | is that also from ghostscript.com/download? | 13:26.15 |
| Oh, it's installed with the gui client but not linked into the start menu? | 13:26.30 |
kens | Its installed yes | 13:26.40 |
| You can't really put it in the start menu, since its a console application | 13:26.53 |
^Simon^_ | true. | 13:27.05 |
chrisl | There used to be a shortcut option for "run in a command prompt window", but I don't see it in Win10 | 13:28.31 |
^Simon^_ | I'm just learning postscript for work and need to be able to keep trying new commands. | 13:28.34 |
| Printing number plates would you believe.. | 13:28.46 |
kens | Well, I've seen stranger. | 13:29.06 |
| One company I know did movie titles with PostScript | 13:29.18 |
chrisl | Hmm, you could use Postscript to generate number plates - if they are generated programmatically | 13:30.06 |
^Simon^_ | yup, they are. | 13:32.10 |
| the font is a special one and has to have specific spacing between the letters etc. | 13:32.33 |
| There's also the border around the edge which follows a rectangular path with rounded corners. | 13:32.59 |
| and then throw the whole .eps to a decent laser printer and out comes a numberplate. | 13:33.26 |
| we can also do temporary road signs, and health and safety signs in a similar manner. | 13:35.06 |
| my next project is going to involve runway signs - that'll be fun. | 13:35.21 |
kens | If you are learning PostScript then I reccomend Acumen Training, John Deubert's "Acumen Journal" | 13:35.45 |
| Free and very useful articles on PostScript programming | 13:36.03 |
| http://www.acumentraining.com/acumenjournal.html | 13:36.47 |
^Simon^_ | found it, thanks! | 13:36.58 |
| Is there a way from the ghostscript prompt (either cli or gui) to load a file containing postscript commands? | 14:04.47 |
chrisl | (path/to/file) run | 14:05.08 |
kens | Yes, look at the PostScript 'run' operator. Also Ghostscritp takes an input file as a command line parameter | 14:05.12 |
^Simon^_ | Perfect :) | 14:06.57 |
| Saves having to keep opening and closing ghostscript to reload a file. | 14:07.22 |
| And the cli versions means I can paste the run line in too. | 14:07.35 |
chrisl | ^Simon^_: You should probably read up on the save/restore operators, too | 14:07.53 |
^Simon^_ | ok, so save takes the current state and pushes it onto the stack, and then restore processes the stack? | 14:22.06 |
| is there a way to show what's in the stack in a debug type view? I can see the prompt says <1> and countexecstack makes it say <2> but then what shows the stack? | 14:23.50 |
chrisl | ^Simon^_: pstack | 14:24.05 |
| IIRC | 14:24.10 |
^Simon^_ | 22 and -save- are the output, so yes.. that sounds likely. | 14:24.37 |
chrisl | restore will expect the save state to the top object on the operand stack | 14:25.07 |
^Simon^_ | yup, so pop to remove the 22 and then restore to remove the -save- | 14:25.34 |
chrisl | Yeh, that effectively returns the interpreter to the state when the save operation happened | 14:26.19 |
| ^Simon^_: I find save/restore are useful when experimenting with code, and you want to ensure that later tests aren't polluted by residual state from earlier tests | 14:29.57 |
^Simon^_ | as soon as showpage runs, it displays Hello World in the image and then when I hit return, it disappears. | 14:31.22 |
kens | That doesn't mean the interpreter state is unchanged though | 14:31.44 |
^Simon^_ | is there a way to output to the console a bit of text or a variable or whatever? | 15:37.48 |
kens | print is the usual method, there are others. | 15:38.19 |
^Simon^_ | (Hi) print | 15:39.00 |
| that works | 15:39.03 |
| but a numeric variable - not so much | 15:39.09 |
chrisl | ^Simon^_: try using "==" | 15:39.31 |
| without the quotes | 15:39.39 |
^Simon^_ | ah yes, that works better. | 15:40.36 |
chrisl | ^Simon^_: you should also read up on the "cv*" operators | 15:41.08 |
kens | I did say there were other ways. You shold normally use cvs to convert non-string operands to string and then print them, == is a quick and dirty solution | 15:41.13 |
^Simon^_ | I saw cvs but couldn't get it to work | 15:41.27 |
chrisl | It's not very hard | 15:41.47 |
| ^Simon^_: You have the PLRM, right? | 15:42.04 |
^Simon^_ | psrefman.pdf from adobe, yes. | 15:42.37 |
| and PLRM.pdf | 15:42.52 |
| I was looking at psrefman.pdf that's edition 2.. oops :) | 15:43.17 |
kens | you don't want the second edition | 15:43.27 |
chrisl | the convert operators were in LL2, though | 15:43.53 |
kens | Not that it matters in the case of cvs, it hasn't changed | 15:44.00 |
| chrisl I'm pretty sure they were in level 1 | 15:44.11 |
^Simon^_ | Yeah, I found cvs in there, but it said it was a substring. | 15:44.16 |
kens | No, it returns a substring | 15:44.24 |
| cvs consumes 'any' and 'string' and returns 'substring' | 15:45.00 |
| "and returns a string object designating the substring actually used." | 15:45.22 |
^Simon^_ | what's the string that it consumes? | 15:45.27 |
kens | You supply it | 15:45.32 |
| Have a look at the examples in the description of the operator, p568 of the PLRM | 15:46.17 |
^Simon^_ | Ah, I didn't get that far down. I was still at about p520 | 15:47.15 |
| where it just lists the definitions | 15:47.18 |
kens | You shold look at the description of the operators before attempting to use them | 15:47.40 |
^Simon^_ | Oh, I see.. so I give it a long enough string to store the stringified version of the variable | 15:48.07 |
| width (abunchofcharacters) cvs print | 15:48.45 |
| and out comes the string 1474.02 | 15:48.58 |
chrisl | or "width 20 string cvs" | 15:49.29 |
^Simon^_ | 20 string results in a string with space for 20 characters I presume. | 15:50.11 |
chrisl | I think it's initialized to all nulls | 15:50.37 |
| Yes, nulls | 15:51.33 |
| (worth mentioning that Postscript strings are not null terminated) | 15:52.00 |
^Simon^_ | do they have a length associated with them instead then? | 15:52.33 |
kens | All strings have a length | 15:53.08 |
^Simon^_ | Well, thanks for all the help - time to head home now :) | 16:01.14 |
| Forward 1 day (to 2016/07/27)>>> | |