[Gena01 Logo]
November 21, 2024, 12:48:06 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Tags Login Register  
Pages: [1]
  Print  
Author Topic: Automate large type for viewing, and small for printing.  (Read 58477 times)
0 Members and 1 Guest are viewing this topic.
Roger
Newbie
*
Posts: 16


« on: April 07, 2008, 03:13:06 pm »

    Automate large type for viewing, and small for printing -- Part I.
    ¯¯¯¯¯¯¯¯ ¯¯¯¯ ¯ ¯¯ ¯¯¯ ¯¯¯¯¯¯  ¯¯¯ ¯¯¯¯ ¯¯ ¯¯¯¯¯      ¯¯¯ ¯
    by Roger A. Jacobson                                        7.April 2008

I have downloaded several identical copies of Win32Pad to my flash drive, and I make simultaneous use of them all as portable apps.  They live on the same flash drive in several specific directories for several specific tasks.  I take them with me everywhere.  All the Win32P executables, or EXEs, that I use are copies or instances of the same EXE or main program.

What makes it possible to dedicate a respective instance of Win32Pad to a specific task is the respective INI which is allowed to accompany each instance of the program's EXE.  Each EXE then has its very own INI, and the two live together in the same folder.  The INI in a folder contains the configurations for the EXE.

The default behavior by contrast of Win32Pad (which is easily overcome and customized) is to use a single INI file for any and all W32P EXEs you may have set up in any and all directories (folders) on your drive. This does not work for flash.  The single INI for all such EXEs defaults to a single hard-drive location, someplace like C:\Programs and Settings — including when you run Win32Pad on flash drive.

To overcome for our benefit this default behavior, especially for flash, we are able to create a nearly zero-length file which will become the INI for each respective Win32Pad.exe to write to. One way to customize is like this:

In a folder where you have a win32pad.exe, open (load up) that EXE by e.g. double left-clicking on it in the Windows file manager.  (Get to the file manager on most systems by holding down WinKey and tapping e, or right-click on START and pick Open. Navigate to the folder and open the folder with a right-click and pick Open or tap o.) What you will see open up after you click on the EXE is of course a blank typing area inside of Win32Pad.  Tap ENT once. Open the File menu to Save As.  TAB to or click Save in: and navigate to the folder where the EXE is that you clicked on (if i.e. what's written there is different from that folder). TAB to or click in File name and type (without quotes) «win32pad.ini» and TAB once to Save as type; tap DN-arrow and END to All Files [ENT]; TAB once to Save and tap [ENT]. Exit via menu, or by ALT+F4. Note: the Windows file manager typically rounds up the size of this new .ini to 1KB. Its initial size is actually a few bytes.

This particular win32pad.exe will henceforth write to and read from this particular INI-file.  Do your settings. The reason it does so is that any given win32pad.exe first looks in its own folder for any INI-file which you may have provided: like we did just now. This EXE can now have its own individual type-face and so on. And these settings are not on C: but on your portable flash-drive.

In short, several copies of the win32pad.exe, along with a specific configuration-file (INI) which accompanies each one individually, allow one to run (what I call) several individual instances of the program. They can all run individually at the same time. A person easily tells them apart visually by how their individual appearance on-screen has been configured.
Logged
Roger
Newbie
*
Posts: 16


« Reply #1 on: April 07, 2008, 03:18:38 pm »

   Automate large type for viewing, and small for printing -- Part II.
   ¯¯¯¯¯¯¯¯ ¯¯ ¯  ¯ ¯¯ ¯¯ ¯¯¯¯¯    ¯¯¯ ¯¯¯¯ ¯¯ ¯¯¯¯¯¯     ¯¯¯¯ ¯
One instance I use of Win32Pad is dedicated to newspaper articles. It is a real plus that Win32Pad lets me copy over a live link along with the news text from the Internet. That all articles are preserved in plain text keeps files small for each article. I for one don't need anything but word wrap and a good-looking font.

For viewing in Win32Pad news articles which I've copied over from online versions, I use what is, for printing, a huge font size: 18. I've meanwhile configured the background colour to look like a hard copy of the Financial Times (orange-y). A Garamond type face in medium-dark olive views nicely against the pale salmon. But printing needs a smaller type face, unless the result is to look like a book for very young children. And it needs jet-black letters. Word wrap ON makes a page look good whether viewed or printed. — Why not, I thought, have two INIs and switch between them?

Because all win32pad.ini files are themselves in plain text, it is easy to switch between an INI for viewing and an INI for printing, and to keep straight which is which.

I keep all my news articles on flash-drive, in their own «News_Articles» folder.  The instance of Win32Pad I use to read them dwells in a sub-folder beneath that one I've named by «Win32Pad_Editor».

Now text files (for beginners) do not need to end in «.txt».  I use «.nws» for newspaper articles. The working environment I operate in is not so much the desktop that the university network provides, as a Commander-type file manager which I run from flash, and which does not write to the Registry or anywhere else on the host computer or network (I use FreeCommanderPortable). In the Commander when I scroll inside of the News_Articles folder to an .nws file and press [F4], the Commander (which is programmable) loads the file into the editor I specify: into viz. my Win32Pad in the sub-folder. (A Commander-type file manager has more features than the file manager that ships with Windows.) What I see is displayed on-screen in Garamond 18. When I want to print, I exit temporarily; switch to a print-config (as explained in Part III); re-load the .nws; and print. — While I'm at it, I might print some other .nws files too. The batch file in Part III below lets me do that. Then I exit and let that same batch file switch my Win32P back to viewing mode. I keep to Garamond for both viewing and printing.

The first batch file (in Part III) contains its own manual set off by double colons. The second, smaller, batch file invokes the first and may be copied to any folder where you might additionally have your copy-and-paste versions of online articles — with viz. the .nws extension you have given to them when you name the file and save it from Win32P to flash-drive. Not all articles you want to refer to stay on-line forever, and it's nice to have them at hand on take-with-you flash.

If you are working from a Commander file-manager, CTRL+D (or similar) provides a command-prompt when you need it.  Otherwise, do a WinKey+R and type CMD [ENT]. The command-prompt is useful to run the second batfile «stfs.bat» (you don't have to type the .bat). Stfs is easy to type with the left hand while the right hovers over the [ENTER] key. If you prefer, you are always able to run a batfile by double left-clicking on it inside of the Windows file manager (batfiles show with gear-icons).

A Commander provides an [F5] key which is easier than typing «copy filename destination». In any case you'll want to copy the stfs.bat over to the parent folder News_Articles. Contained in the sub-folder Win32Pad_Editor, conveniently out of sight from the .nws files, are the following: win32pad.exe, -.cnt, -.hlp, -.ini and a history- and readme.txt. In Part III we will add two batfiles (.bat) to this list of items.

If you are not working from a Commander but from the Windows file-manager, you will still be able to display your .nws files inside your configured Win32Pad: Right-click on an .nws and pick Open With and then navigate to the News_Articles\Win32Pad_Editor folder and pick win32pad.exe. After you do this Open With routine once, the file-manager will «remember» your choice and [typically] present Win32Pad under a highlighted «Recommended» [OK].
« Last Edit: April 08, 2008, 10:32:29 am by Roger » Logged
Roger
Newbie
*
Posts: 16


« Reply #2 on: April 07, 2008, 03:45:25 pm »

  Automate large type for viewing, and small for printing -- Part III.
  ¯¯¯¯¯¯¯¯ ¯¯¯¯ ¯¯¯¯ ¯¯ ¯¯¯¯¯¯   ¯¯ ¯¯¯¯¯ ¯¯ ¯¯¯¯¯¯    ¯¯¯¯ ¯¯
Change to the subdirectory Win32Pad_Editor which we've created below the directory N:\News_Articles, where N = letter Windows assigns to the flash. (In the Windows file-manager, do a right-click and tap letter «o».) If you haven't any Notepad-like editor set up elsewhere on your flash (except the Win32Pad, which with Garamond configured will not render everything in the batfiles below 100% correctly), simply invoke plain old Notepad for now, which is probably already using some monospace font like Courier New or Lucida Console = what we want. Get to Notepad by START->All Programs -> Accessories, or by WinKey+R and type notepad [ENT]. Click File -> Save As and navigate to the Win32Pad_Editor subdirectory. Click the DN-arrow by «Files of type» and click All Files. Shift+TAB once to (or click) File name and type «Switch_INI_INK_W32P.bat» (no quotes) and TAB twice to SAVE [ENT].

Copy and paste the first batfile into Notepad and save. Click File->New and copy and paste the second batfile into Notepad.

Click File->Save As and (as before) pick All Files and (in File name) type «stfs.bat» (no «») -> [SAVE].

Do File -> Exit or (from keyboard) ALT+F4 to quit from Notepad.



                          Switch_INI_INK_W32P.bat
Code:
@echo off & goto go
::
:: =  Win32P for Viewing On-Screen -- and Win32P for Printing Hard-Copy. =
::    ¯¯¯¯¯¯ ¯¯¯ ¯¯¯¯¯¯  ¯¯ ¯¯¯¯¯¯    ¯¯¯ ¯¯¯¯¯¯ ¯¯¯ ¯¯¯¯¯¯¯  ¯¯¯¯ ¯¯¯
::    How to swap between two INIs -- and use a small type for printing.
::   
::   (Win32Pad as viewer, with large type face; yet print in small-face.)
::    ¯¯¯¯¯¯¯¯ ¯¯ ¯¯¯¯¯¯  ¯¯¯¯ ¯¯¯¯¯ ¯¯¯¯ ¯¯¯¯  ¯¯¯ ¯¯¯¯¯ ¯¯ ¯¯¯¯¯ ¯¯¯¯
::
::   Roger A. Jacobson          • Solution •               7.April 2008
::                                ¯¯¯¯¯¯¯¯
:: = Automate the Swapping of win32pad.ini for an .ink - and vice versa. =
::   ¯¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯¯¯¯¯  ¯¯ ¯¯¯¯¯ ¯¯ ¯¯¯ ¯¯¯ ¯¯  ¯¯¯   ¯¯¯ ¯¯¯¯ ¯¯¯¯¯
::   After initial setup is completed (below), the .bat works like this:
::   
:: [¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯]
:: | The batch-file provides win32pad.exe with one .ini for viewing and  |
:: | a second for printing. To print: exit from win32pad in viewer-mode; |
:: | run this batfile; reload win32pad; print; exit. Then rerun the bat. |
:: |                                                                     |
:: | When i.e. you're done with printing - then restore the viewer-mode: |
:: | when namely you next run this bat, the viewer-settings switch back. |
:: |                                                                     |
:: | The viewing INI is kept in INK when printing: then is swapped back. |
:: |     ¯¯¯¯¯¯                 ¯¯¯      ¯¯¯¯¯¯¯                         |
:: | A for-print INI is kept in INK when viewing: swapped back to print. |
:: |   ¯¯¯  ¯¯¯¯                ¯¯¯      ¯¯¯¯¯¯                   ¯¯¯¯¯  |
:: [_____________________________________________________________________]
::   
::
::   Initial setup: exectute COPY WIN32PAD.INI *.INK (make second copy).
::   ¯¯¯¯¯¯¯ ¯¯¯¯¯
::   The two copies INI and INK are for now 100% the same. The ink copy
::   will become the ini for printing.  The original ini is for viewing.
::        ¯¯¯¯¯¯
::   The viewing copy of ini will have larger type; print copy, smaller.
::       ¯¯¯¯¯¯                         ¯¯¯¯¯                   ¯¯¯¯¯¯¯
::   Test-run the present batch file now before putting it into service:
::   ¯¯¯¯ ¯¯¯
::   The messages that appear during the test-run show that ini and ink
::   got swapped. Test-runs are to make sure that the bat-file works as
::   intended and that no typing or copy-and-paste errors have crept in.
::
::   Test it as many times as you want: ini and ink are still identical.
::                                      ¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯
::   
::   Now let Win32Pad load up some file you enjoy viewing in large type;
::   Set the font size downwards to print - and set font color to black.
::                                                                ¯¯¯¯¯
::   You are now able to print out your text - with a smaller type face.
::   
::   When you do save the print-settings, Win32Pad records them to .ini.
::   The print settings you've just now saved will wind up in INK since
::   when we are done printing one or more Win32Pad files, we rerun bat.
::   ¯¯¯¯ ¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯  ¯¯¯ ¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯¯ ¯¯¯¯¯  ¯¯ ¯¯¯¯¯ ¯¯¯ 
::   Please quit now from Win32P whose INI is temporarily used to print.
::   Running bat again restores the viewing INI and stores print in INK.
::
::   If running this .bat conveniently with FreeCommander or equivalent:
::   Scroll within the file manager to where current .bat-file is found:
::   It is meant to reside in the same folder as win32pad.ini and -.ink:
::   in i.e. the folder where the corresponding win32pad.exe is located.
::                                              ¯¯¯¯¯¯¯¯ ¯¯¯
::   Press ENT to run the batfile and to switch extensions ini with ink.
::   They are the same except FontSize=360 (ini) and FontSize=280 (ink);
::   and FontColor=0 (in the ink) -- which is good (black) for printing.
::   Garamond works well - its notion of single-spaced lines is elegant.
::   When you are done with printing -- switch again by re-running .bat.
::   
::   I like the print INI configured to «Exit on <Esc>», but not viewer.
::              ¯¯¯¯¯                    ¯¯¯¯ ¯¯  ¯¯¯
::   It is a handy workaround for those times when you do wish to print,
::   yet you otherwise enjoy an oversize type-face for viewing the text.
::                                                     ¯¯¯¯¯¯
:go
::
if not exist win32pad.ini goto end
if not exist win32pad.ink goto end
if not exist win32pad.exe goto end
::
::   These three IFs make sure this bat-file runs from the right folder.
::
ren win32pad.ink *.ikk > nul
ren win32pad.ini *.ink > nul
ren win32pad.ikk *.ini > nul
::
echo. & echo       win32pad.ini is now become an .ink --
echo. & echo       win32pad.ink is now become an .ini --
echo.
find /c /i "Fontsize=360" win32pad.ini > nul
::                     ^
::   Replace the «360» ^ with the number from your .ini for larger type:
::   otherwise, you will think that test-runs ¯¯¯¯          ¯¯¯¯¯¯ ¯¯¯¯
::   of this .bat file have changed something in your original ini-file.
::
set findsize=%errorlevel%
if %findsize%==0 goto large
echo       Type face is set small for printing.
echo                                  --------
goto pauser
::
:large
echo       Type face is set large: for viewing.
echo                                   -------
::
:pauser
echo. & echo.
echo. & echo       Tap spacebar when ready to conclude.  & echo. & echo.
pause > nul
::           « > nul » blanks pause's standard message.
::             ¯¯¯¯¯          ¯¯¯¯¯
set findsize=
:end
exit



                             stfs.bat

Code:
 @echo off & cls
::
::
::  Run the Switch_INI_INK bat-file from any folder.
::  ¯¯¯ ¯¯¯ ¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯ ¯¯¯ ¯¯¯¯¯¯
::  Roger A. Jacobson                 7. April 2008
::
::
::  This batch file stfs.bat «Switch Type Font Size»
::                  ¯¯¯¯ ¯¯¯  ¯      ¯    ¯    ¯
::  runs Switch_INI_INK_W32P at any folder of drive.
::
::  which would otherwise require Switch be in PATH.
::                                             ¯¯¯¯
::  stfs must reside in the folder where you run it,
::  ¯¯¯¯             ¯¯
::  and: stfs and Switch_INI_INK_W32P on same drive.
::                                            ¯¯¯¯¯
::  Make plural copies (1/folder) of stfs as wanted.
::                                   ¯¯¯¯
::  Actual commands begin at line 1 and resume here.
::
cd\
::
::  Change to the root directory of the flash-drive.
::
if exist %cd%News_Articles\Win32Pad_Editor\Switch_INI_INK_W32P.bat goto go
::
goto end
::
::  Check for existence of «Switch_INI_INK_W32P.bat»
::  in the folder N:\News_Articles\Win32Pad_Editor\,
::  where N is the letter Win assigns to your flash.
::  If it doesn't exist where expected, quit batjob.
::
::  If you name the «Switch_INI» batfile by another
::  name, or if you locate that batfile (along with
::  win32pad.exe and the INI and INK) elsewhere you
::  will want to modify the present stfs.bat to fit.
::                                  ¯¯¯¯ ¯¯¯
:go
::
cd News_Articles\Win32Pad_Editor\
::
::  Change to the directory where the Switch bat is.
::
Switch_INI_INK_W32P.bat
::
::  Run the batfile named «Switch_INI_INK_W32P.bat».
::
:end
exit

The first .bat always stays in the sub-folder.
The second, shorter batch file can be copied to anywhere (including to the «parent» folder [«parent directory»] News_Articles where .nws files reside.)


- - - - - - - - - - - - - - - - - - - - -


«Es stimmt nicht, daß die Kühe Milch geben --
  Die Bauern nehmen sie ihnen einfach weg.»
 
(Radio Holiday)
 

 
- - - - - - - - - - - - - - - - - - - - -

Submitted by © Roger A. Jacobson 2008. All rights reserved.  Alle Rechte
vorbehalten der Übersetzung einschließlich.  This document may be freely
distributed without alteration of its contents,  ———  in keeping with the
license agreement of Win32Pad. Reviewers may quote freely citing source.
« Last Edit: April 08, 2008, 10:34:17 am by Roger » Logged
Tags:
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines | Sitemap Valid XHTML 1.0! Valid CSS!