Tim Doty
From: United States
Registered: 2006-02-06
Posts: 2939
|
Hi Malcolm,
Sorry you are having so much trouble with this, I will try and clarify the situation. Historically, getting python and thus scripts going on a windows system has been straightforward -- I didn't think at all about Win7 being 64 bit and thus someone grabbing a 64 bit version of python. Because PgS is a 32-bit application it needs to have 32-bit python available. And Windows is the only platform this is an issue (python is included in linux and OS X).
If the menu is available then the remaining items have to do with *this* script and a shortcut it takes by using a pre-generated document rather than creating one on the fly to use as the basis for creating the font spec sheet. Other scripts don't have the same issue and this one would go away if there were an option for forcing PgS to load the document without concern for font substitution choices -- which are moot as the font will be set programmatically anyway to one that is installed on the system.
Finally, it comes down to how the script loads and then addresses the document. Because a user can have more than one document open, the script must have a way to specify the particular document it wants to address. Regrettably, the OpenDocument() function doesn't return the document title to the script so we have to make sure that the document title is what the script thinks it is. In this case I have settled on 'FontSpec'.
The catch is that PgS doesn't allow two open documents to have the same document title, so if you open a second document with the same title, PgS will alter it. For example, if you open a document whose title is FontSpec, and then open a second document whose title is also FontSpec the second document's title will be changed to 'FontSpec 1' (I believe, maybe it is 'FontSpec 2', but at the least it *will* change it by using an incrementing number at the end). PgS has to resolve such a conflict to maintain that each open document has a unique title.
Users often don't see this because they don't usually re-use document titles and don't open the same file twice. I see it when I'm comparing two versions of the same document (e.g., a back up with the current version), but that isn't exactly every day usage.
The document title may be the document's file name (IIRC that is what it defaults to), but the two are otherwise unrelated. You can change the document title at any time by going to the menu and setting it.
The confusion arises because user's may not even be aware of the document title, or think that it is the same as the document's file name because that is what it defaults to. Both FontSpec1.pgs and FontSpec6.pgs have the same document title to make the constant used by the script consistent.
The first issue (having to open and save FontSpec1.pgs and FontSpec2.pgs) would be eliminated if Deron added a parameter to the OpenDocument() function that allowed forcing acceptance of default options for font substitution. This has come up before and still doesn't exist to my knowledge
The second issue (having to ensure the document title is 'FontSpec') would be practically a non-issue if users did not have to open and save the font spec documents, but would be completely eliminated if Deron added the document title to the OpenDocument() function's return dictionary. That would actually be much better in general as it would allow a script to automatically know the title for any document it opened.
If Deron addressed the first, use of FontSpec.py would be simplified greatly and addressing the second would complete things for this script and in general make scripting easier.
Tim Doty
On 08/03/2012 01:02 AM, M. Kays wrote: > > Hi Tim, > > I had no idea that this was so complicated! When I read the first round > of exchanges regarding this topic on the thread, I thought 'this sounds > interesting -- I'll try it out'. I naively assumed that I just had to > open PageStream, run the script, and . . . bingo! . . . there would be a > nice set of font pages in my print queue, waiting to go. I knew that I > had Python installed correctly, so I didn't envisage any problems. > > Incidentally, I should perhaps explain my set-up a little, but I don't > think that is the cause of my problem. I have my OS (Windows 7) > installed on a solid-state device (SSD) drive -- my C: drive -- for fast > access, but all my 'data' (documents and other files) are stored on a > big hard drive (my 'E: drive'), because the SSD isn't all that large. > The PageStream folder is installed on the C: drive, in the 'Program > Files (x86)' folder. While there is a copy of the scripts folder within > the PageStream one there (dating from my original installation or, > perhaps, my most recent update of PGS), it has been copied across to a > general PageStream Documents folder that I have created on my E: drive. > In keeping with this change, my preferences in PGS point to this E: > drive location for the scripts folder, and for my documents. So, I > don't believe that PGS should be looking in the wrong place for my > scripts and documents. > > Anyway, I'm not at all surprised that the FontSpec script did not work > for me the first few times I tried it, as I wasn't doing all those other > things that I now know I should have done first. That's not your fault: > you did provide documentation, in the form of the FontSpec html file in > the scripts folder, but I just didn't know it was there. On these > grounds, there wasn't necessarily any problem with your script at all! > (Although I gather there was.) > > Obviously, I am now better-informed about what I should be doing, but > I'm still not getting results! > > I agree with Theo that points 5 & 6 in your instructions, taken together > with the single-asterisked footnote, create a contradictory situation. > If you open FontSpec1.pgs, make sure that its 'title' (= file name?) > hasn't changed, and then save and close it, then surely it will still be > called 'FontSpec1.pgs'. (And yet you say "It /must/ be FontSpec for the > script to work. If it says FontSpec1 it will not work"). > > Anyway, if I do open Fontspec1.pgs, I find that no font substitution is > necessary, and -- as I have made no changes -- PGS won't allow me to > save it anyhow (because it isn't necessary): the save option is 'greyed' > or ghosted out. So, reading between the lines about what you might have > really meant in your instructions, I did a 'Save as', giving the name > 'FontSpec.pgs'. I then closed it and then, to keep PGS 'alive', I > opened a new, blank document. I then ran the script (keeping the > default of 'one font per page' and 'all fonts'), and absolutely nothing > happened. Undaunted, I thought 'maybe I have to reopen the 'FontSpec' > file I had created first (even though you had said to close it after > doing the save), so I did that and re-ran the script. Again, absolutely > nothing happened, and there was nothing in my print queue. > > I noted that the 'FontSpec' file had been saved in my Scripts folder > (understandable, as that was where FontSec1 and FontSpec6 were stored), > so I copied it into my PGS documents folder and tried the script again, > with just a new, blank document again. This time, something happened: I > saw the 'creating font specimens' progress bar quickly flash on and off > the screen and then the 'waiting' pointer came up, slowly rotating. > Strangely, though, when I moved it off the PGS window, the pointer > turned back to the normal arrow (as expected), but when I moved it back > over the PGS screen it remained that way, even when I clicked in the > window. It was not a matter of coincidence (i.e that the process just > happened to stop as I moved the pointer from the window, as I repeated > the process a number of times -- very strange indeed). Anyway, this > gave me hope that something had finally happened, but when I looked in > the print queue there was nothing there. (I had left my printer turned > off, as I didn't want to waste reams of paper!) > > I then tried the procedure with FontSpec6.pgs, this time doing a 'save > as', under the name 'FontSpec.pgs', into both my PGS documents and > scripts folders. (There were no font substitutions to make.) I started > up PGS again, with a blank document, ran the script, selecting 6 fonts > per page & all fonts, then the 'Creating Fonts Specimens' progress bar > box came up, finished after a few seconds, then I got the rotating > waiting pointer again, waited a while, then moved the pointer off the > PGS window. As before, it turned into an arrow and remained so when I > moved it back over the pGS window, even if I clicked in it. I checked > the print queue again --> nothing. I then tried it all again, this time > with the FontSpec.pgs document open on the PGS screen. The same > promising things happened as above, and this time I left the rotating > waiting pointer on the PGS screen for at least two minutes before moving > it off (to see if anything was appearing in the print queue): as before, > it turned into an arrow and would not revert to the waiting pointer when > moved back over the PGS window or clicking in that window. Surely, just > moving the pointer out of the PGS window would not halt the > process!!?! Anyway, I then checked my print queue again and, as usual, > it was empty. > > Surely not having my printer actually turned on shouldn't thwart the > exercise, should it? My experience -- I am sure -- has been that, if I > forget to turn the printer on, the job remains waiting in the queue > until I realise and do turn it on, in which case the printing goes ahead > as intended. > > I give up! This will teach me not to try things out just because they > sound as if they might be useful! Not your fault, Tim -- you have > obviously put a lot of first-rate work into your scripts over the years, > and this one does work for you. I can't imagine what the problem is at > my end, but it's probably not worth you or I losing any more sleep > over it. > > Cheers, > > Malcolm > > Malcolm Kays > South Hobart Tasmania AUSTRALIA > > [Non-text portions of this message have been removed] > >
[Non-text portions of this message have been removed]
|