XyPy (XyWrite 4 + Python): Quick Start Instructions --------------------------------------------------- 1) Install Python 3 (latest version): (free download at http://www.python.org/download/) During installation, at the Customize Python 3.3 screen, be sure to choose the option to "Add python.exe to search path". 2) Download XyPy here: 3) Unzip XYPY.ZIP (all files) into your XyWrite directory (the directory that has Editor.EXE). 4) MErge XYPY.FRM into your U2 file, near the top of the U2 file. (Delete any earlier version of these frames.) Do NOT SAve U2; rather, issue LOADHELP, then ABort U2. 5) Issue MAKEXYPY to install the XyPy Python module (xy.py). This also sets variable Python_EXE, in XYWWWEB.REG, to identify the path location of python.exe. Alternatively, if you are already running XyPy v0.81 or later, simply UNZIP XYPY.ZIP into the directory that contains EDITOR.EXE -- be sure to OVERWRITE all existing files -- then issue: UPDATEXYPY You're done! Now, try out the demo routines listed below. Read XYPY.TXT (in http://users.datarealm.com/xywwweb/XYPY.ZIP) for further information. Demo Frames =========== XyPy includes several demo routines. Some serve mainly as proof of concept; others are actually useful. Feel free to suggest or write real-world applications of your own. The demo routines include: GOOPY [search terms] Google search WEB [url] - Open URL in the default browser. - URL can be specified on the CMline or DeFined in text. If nothing is DeFined and the cursor is in text, frame WEB tries to "lift" the URL (if any) under the cursor. If the URL does not specify a protocol, 'http://' is prepended. Frame WEB uses Python's webbrowser module to create a Xy CMline-Web interface in two (2) lines of XPyL code! WEB [alias] [Alias] is a single-word abbreviation for a full URL. Set your aliases by adding lines to XYWWWEB.REG, thus: URL1=monty=http://pythonline.com/ URL2=cye=http://en.wikipedia.org/wiki/List_of_Curb_Your_Enthusiasm_episo des#Series_overview URL3=xyw=users.datarealm.com/xywwweb/ [etc.] Then, for example: WEB monty opens WEB [short_name] Single-word URLs not in dictionary are rendered as www.URL.com. For example: WEB ebay opens . LOOKUP [YA][suffix] search_term(s) Web lookup via U2 frame YA* YA__ framenames must be correctly configured in the XyWWWeb REGistry (XYWWWEB.U2). Command HELP YA for further information. VERITAS [keyword(s)] Wine|Liquor search via wine-searcher.com GETM Read your e-mail messages in a XyWrite Untitled window Note 1: You will be prompted for your POP server name and e-mail address. Alternatively, this information can be supplied by setting user variables in XYWWWEB.REG, like this: ; Email_Address=myname@myISP.com POP_Server=pop.myISP.com ; Note 2: You will be prompted for a password. Exercise caution when entering it as the password will be displayed! LISTWORDS [d:\path\filename] Compiles a sorted list of all unique words in current or specified file; also reports average word length FUNCSPY Use Python to construct and list all XyWrite 3-byte functions in an Untitled window WILDPY Use Python to construct and list a full set of 3-byte reverse-video Ascii chars (a subset of which constitutes XyWrite's SEarch wildcards) in an Untitled window 3BYTERSPY Use Python to construct and list a full set of XyWrite's printable 3-byte character set (including characters that cannot be displayed or printed in XyWrite in 1-byte form) UH-HUH: Unlimited Hint These companion routines extend Robert Holmgren's command Stack utility by enabling unlimited command archiving and retrieval. Stack's command history can hold about 200 commands in memory. That sounds like a lot, but in an active editing session useful commands are quickly pushed down and out of the stack. Although Stack has a facility for saving the command history to a file for later retrieval, the number of commands in any such file is still subject to the (approximately) 200-command limit. UH-HUH overcomes this limitation, enabling *all* commands to be archived permanently to disk, to be retrieved at any time by Stack's trademark method of providing a "hint", or substring, of the desired command. (UH stands for Unlimited Hint, HUH for Have Unlimited Hint.) The catch is that you *must* establish frame HUH in an XPL routine that you run *every time you quit XyWrite*. (The Jumbo U2 includes such a routine: FINITO). Do this by adding the following line to FINITO or your own routine: JM 2.huhQ2 ;*; New (7/28/13): XyPy now includes frame FINITO so modified. (If Python or Stack is not detected, HUH backs off quietly.) Alternatively, you can assign HUH to a key, along with the QUIT command, in the KBD file: nn=NOJM2,.,h,u,h,Q2BXq,u,i,t,/,n,v,Q2 HUH can also be assigned to another key to allow easy updating of STACKALL.SAV during editing sessions. Alternatively, you can manually issue HUH after Stacking a key command to ensure that it is permanently archived. Every time you run HUH, the command stack is merged into STACKALL.SAV, located in Editor's directory. STACKALL.SAV is a sorted listing of archived commands; (duplicate commands are purged). To retrieve commands from STACKALL.SAV, use frame UH to issue a (case-INsensitive) hint, or fragment of the desired command; for example: UH .txt [list all commands containing string '.txt'] A sorted list of commands containing the hint is opened in a new XyWrite window. To pop any command to the CMline, place the cursor on the desired command and hit . Once popped and reSTACKed, archived commands re-enter the active command Stack and become accessible by scrolling through the Stack (Up|Down arrow keys or frame STACKBOX) or normal Stack hinting. New (7/29/13): UH now works on non-Python setups; STACKALL.SAV must be present in Editor's directory. Python is still required to run HUH, which creates and updates STACKALL.SAV, but you can now enjoy UH on Python-less systems simply by copying your STACKALL.SAV to Editor's directory. New (10/16/13): HUH now also works on non-Python setups, via a new frame HUHXPL, which is called by HUH if a Python installation is not detected. As a result, a STACKALL.SAV created on a Python-enabled Xy setup can be copied to a non-Python XyWrite directory and used interchangeably on the two setups. See also frame ADDSTACKALL (immediately below), which enables STACKALL.SAV archives created on different XyWrite setups to be merged into a single STACKALL.SAV, useable on all setups. New (10/27/13): Frame ADDSTACKALL enables merging a separate STACKALL.SAV-type file into STACKALL.SAV. Command-line usage is: ADDSTACKALL [d:\path\filename] where "d:\path\filename" is the file to be merged into STACKALL.SAV. The file-to-be-merged must be formatted either one command to a line (like STACKALL.SAV) or Ascii-190[command]Ascii-190[command]Ascii-190 ..., like the native command stack created by STACK.PM (located in Save/Get 623). Use ADDSTACKALL to merge STACKALL.SAV files from multiple XyWrite setups into a single STACKALL.SAV. I use ADDSTACKALL to keep my home and work copies of STACKALL.SAV in sync. New (10/30/13): STACKALL.SAV now lists each command on a separate line (ending with CrLf) instead of using STACK.PM's native Ascii-190 command separator. The new format makes it easier to browse and manually add commands to, or delete commands from, STACKALL.SAV. Also new: UH, with no hint/argument, CAlls STACKALL.SAV for viewing or editing. New (11/01/13, 11/11/13): New frame ADDCM allows the current CMline (or a DeFined block of not more than 79 characters [bytes]) to be added to the STACKALL.SAV command archive even if STACK.PM is not installed. ADDCM must be assigned to a key of your choosing in the KBD file, with: nn=NOJM(,2,.,a,d,d,C,M,) Hit your dedicated ADDCM key to add the current CMline to STACKALL.SAV. (Stack users can use ADDCM as well.) ADDCM opens up the possibilities of UH-HUH unlimited hinting to all Xy4 users, whether or not STACK.PM is installed -- and whether or not Python is installed as well. UH-HUH really does provide unlimited hinting. The STACKALL.SAV archive can grow indefinitely, and may come to contain many hundreds or even thousands of commands. In my tests with a manufactured STACKALL.SAV archive with 130,000+ commands, UH instantaneously processed a hint that returned over 2,000 matching commands; a hint that returned more than 70,000 matching commands took just a couple of seconds to complete. HUH had no trouble removing duplicates from this 2 Meg archive, immediately reducing it to a 20KB file of about 1300 commands. UH-HUH, it works! UHDEL [string] Delete all commands containing string from STACKALL.SAV command history archive file. Two (2) available windows required. UHDEL also works on non-Python Xy setups; STACKALL.SAV must be present in Editor's directory. - - -