home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / hotkey01.zip / README.1ST < prev    next >
Text File  |  1998-01-27  |  18KB  |  348 lines

  1. The following text is copyright Gary Britt, CompuServe ID 72073,2445.
  2.  
  3.  
  4. The following explanation details how to setup OS/2 so that you can configure
  5. hotkeys for your programs that allow you to jump directly from where you are
  6. to a specific program.  There are several commercial, shareware, and freeware
  7. programs available that allow you to do this, but none of these programs allow
  8. you to hotkey "FROM" a full screen windows session.  All but one of them don't
  9. allow you to hotkey "FROM" a full screen DOS session of any kind.
  10.  
  11. By following the instructions that follow you can setup OS/2 to allow hotkey
  12. jumping from seamless/windowed programs AND from full screen windows and full
  13. screen DOS sessions.
  14.  
  15. What is necessary is to put together a few publicly available shareware and
  16. freeware OS/2 programs, and then configure things properly.
  17.  
  18. First you need to get one of the freeware or commercial hotkey programs for 
  19. OS/2.  There are two good freeware hotkey programs available for OS/2.  One
  20. is HookXX.zip by Morton Kaplan (I believe Hook55.zip is the current edition)
  21. and another is Jumpkey/2, which is IBM employee written software by Thomas E.
  22. Link.  Mr. Link is still an employee at IBM.  While both of these are
  23. excellent, I prefer Jumpkey/2 because it has an easier to configure interface.
  24. However, Hook has some features that Jumpkey/2 doesn't.  I have included
  25. Jumpkey/2 as part of this upload.  Normally Jumpkey/2 allows hotkeys based
  26. upon Control+<key>, Alt+<key>, and Control-Shift+<key>.  I prefer using
  27. Control-Alt+<key> hotkey combinations, and if you are like me then you can
  28. substitute the Hotdll32.C-A file for the Hotdll32.dll file.  Just rename
  29. Hotdll32.dll to something like Hotdll32.ORI and copy Hotdll32.C-A to
  30. Hotdll32.dll.  Thereafter when you select a hotkey based upon Control+Shift
  31. +<key> in the configuration dialog of Jumpkey/2 it will really work as 
  32. Control+Alt+<key>.  There is a text file that details how the DLL file was
  33. modified if you are interested or want to implement Alt+Shift+<key> hotkeys.
  34.  
  35. Using Jumpkey/2 (or Hook) takes care of having hotkeys for jumping between
  36. seamless and windowed DOS, OS/2, and windows programs.  The instructions below
  37. will show you how to configure hotkeys to jump FROM full screen windows and
  38. DOS sessions.
  39.  
  40.  
  41. Here is how to setup hotkeys to jump from full screen windows and DOS 
  42. sessions:
  43.  
  44. 1.  Download the freeware FM_Utilities available on CompuServe,
  45. and off the web, by Mark Kimes (author of the FM/2 OS/2 file manager).  
  46. Among these very handy utilities are two programs called "Switchto" and 
  47. "Switchtp".  Switchto lets you switch from a full screen DOS/windows session 
  48. to another full screen DOS/windows session. Switchtp lets you switch from a 
  49. full screen DOS/windows session to a Presentation Manager OS/2, DOS, or 
  50. seamless windows session.
  51.  
  52. 2.  Switchto takes as a parameter the name of the session to be switched
  53. to.  Get this name from the right hand side of the OS/2 task list.  For
  54. example I run a full screen DOS program called Xtree Pro Gold.  It appears
  55. in the task list as "Xtree Pro Gold - XTG.EXE".  To use Switchto to switch
  56. to this program the command line is  - Switchto xtg  - .
  57.  
  58. Switchtp takes as a parameter the name of the PM session to be switched to
  59. as shown on the right hand side of the OS/2 task list.  For example, 
  60. if I am in a full screen DOS/windows session and I want to switch to 
  61. "Microsoft Word - Microsoft Word - Document 1" running seamless on my 
  62. desktop the command to do this is  -  Switchtp "Microsoft Word".
  63.  
  64. 3.  To get a feel for how this works you can manually enter these commands
  65. at a full screen DOS prompt or by using the "File - Run" dialog of program
  66. manager in a full screen windows session.  Play with these commands manually
  67. from the command line a few times until you understand how they work.
  68.  
  69. 4.  Once you see how these commands can be used on your system, the final
  70. step is to find a way to configure your full screen sessions so that these
  71. commands can be processed automatically via the striking of a hotkey.
  72. This turns out to be much easier than one would suspect.  It is actually
  73. easiest to setup in a full screen windows session versus a full screen DOS
  74. session!!
  75.  
  76. 5.  Windows provides several ways to launch a program via the selection of
  77. a hotkey.  One way that anyone can do with just the programs already on
  78. their hard disk is as follows:
  79.  
  80.       A.  Setup a separate icon in program manager (use File - New) for
  81. each full screen or PM session that you might want to switch to from your
  82. full screen windows session.  The command line for these program manager
  83. icons on my system would be something like  -  c:\<path>\switchto xtg   -
  84.  or  -  c:\<path>\switchtp "Microsoft Word"  -.
  85.  
  86.       B.  You will notice that when creating a new icon for a program to
  87. be launched in windows' program manager that you can assign a hotkey to
  88. this program.  Be sure to select a hotkey when completing the dialog for
  89. these new icons.
  90.  
  91.       C.  Bingo that's all there is to it.  From then on anytime you are
  92. in a full screen windows session if you make program manager active and
  93. hit the hotkey you will be automatically switched to the full screen
  94. DOS/windows session or PM session selected for that icon!!!!!!
  95.  
  96.       D.  You can create a hotkey that will make program manager active by
  97. creating an icon for program manager itself (i.e. progman.exe) and
  98. assigning a hotkey to this icon.  Then put this icon in your windows
  99. startup group.  A second copy of program manager will not be run, but the
  100. hotkey for program manager will be activated so that you can strike the
  101. hotkey for program manager from any windows program and then immediately
  102. strike the hotkey for the session you want to switch to and VIOLA.  You
  103. switch from a full screen windows session to any other session via a
  104. hotkey.
  105.  
  106. 6.  Now the above is just one of many ways that could be setup to hotkey
  107. from a full screen windows session.  You can use almost any windows 3.1
  108. utility program that allows for the launching of a program via hotkey to
  109. do the above.  You could use almost any windows 3.1 program that provides
  110. a popup menu to select a program from to run to setup a hotkey for
  111. launching these switchto/switchtp programs.  
  112.  
  113. For example, I have always used an absolutely fantastic keyboard/macro/hotkey 
  114. program for windows 3.1 called "whiskers".  It used to be available on  
  115. CompuServe in the IBMSYS or IBMAPPS forums as shareware.  With this program 
  116. I can configure hotkeys to launch the switchto/switchtp commands and the 
  117. hotkeys are valid no matter what program is active in windows (i.e. you don't
  118. have to bring program manager up before you can hotkey).  Another shareware 
  119. program I use (and registered long ago) is Plugins for Program Manager, by 
  120. Planet Crafters.  Its available on the web and the CompuServe winshare forum.  
  121. It can be configured to popup via a hotkey a menu list of programs that it 
  122. will launch.  The programs on this menu are fully user configurable.  
  123. You could use this popup menu to hotkey launch these switchto/switchtp 
  124. commands.  There are probably many other windows 3.1 utilities that can be 
  125. used to do what needs to be done.
  126.  
  127.  
  128. 7. Configuring a full screen DOS session to hotkey switch to another session
  129. is a little trickier because unlike in windows there is no direct way to
  130. launch a program from the DOS program you might be running.  However, where
  131. there is a will there is a way!!
  132.  
  133. 8.  First you need to use Popup 1.14 a DOS utility included in this zip file.
  134. Popup is a shareware program.  This is a DOS TSR utility you load as part of 
  135. your autoexec.bat for your DOS sessions.  It takes only 7k of ram.  Do NOT 
  136. load it high.  It won't work.  This utility can be configured to popup via 
  137. hotkey a DOS command line OR it can be configured to LAUNCH a program 
  138. immediately upon popping up!!  With this feature you can create a method to 
  139. hotkey from a full screen DOS session to any other full screen or PM session!!
  140.  
  141. 9.  For example in my autoexec.bat file in the root directory of my OS/2 
  142. boot drive I have the following line:
  143.  
  144.   c:\popup\popup -cc:\popup\switch.com -pe:\win\temp -n -a -4 -m128 -HC:A
  145.  
  146.   The above line loads the PopUp.exe program and tells it to run the
  147. program I created called "switch.com" immediately upon popping up.  (More
  148. about "switch.com" in a moment).  It further tells Popup to store any temp
  149. files it creates in the e:\win\temp directory, that popping up over
  150. extended text mode screens is allowed, and that it should only allocate and
  151. swap out 128k of memory (you can make popup swap out much more memory but
  152. 128k is all that is needed and the less it has to swap the more
  153. instantaneous the swapping).  My hotkey is ctrl-A.  On my 486 120mhz
  154. computer Popup's handling of the hotkey and switching is instantaneous.  It
  155. pops up and executes the switching command just as fast as I can press the
  156. key combination.  It works beautifully!!!
  157.  
  158. 10.  Now about switch.com.  Switch.com is a compiled batch file.  I compiled
  159. it with the freeware PC Mag utility called bat2exe by Doug Boling.  
  160. This program should still be available to download from ziff on CompuServe or 
  161. from the ziff website.  You can configure popup to execute a plain batch file 
  162. if you can't get bat2exe or some other batch file compiler, but a compiled 
  163. batch file is faster because popup doesn't have to first start command.com 
  164. before executing the batch file.  
  165.  
  166. 11.  This is what the batch file/source code looks like which I compiled into 
  167. switch.com.  You could adapt it for your use if you desire.
  168.  
  169.  @echo off
  170.  @echo
  171.  @echo
  172.  @echo Select Program To Switch To
  173.  @echo
  174.  @echo
  175.  @echo 2 = Xtpro
  176.  @echo 6 = Labelpro
  177.  @echo A = Rolodex
  178.  @echo C = Calculator
  179.  @echo K = Sidekick
  180.  @echo L = LaunchPad
  181.  @echo O = Ozcis
  182.  @echo W = Word
  183.  @echo Y = TN
  184.  @echo
  185.  @echo
  186.  REM I am using the choice.com program from DOS 6.x.  It works fine under OS/2
  187.  c:\dos\choice.com /c:kowlc2y6an /n Press N To Abort Switching
  188.  If errorlevel 10 goto end
  189.  If errorlevel 9 goto rolodex
  190.  If errorlevel 8 goto winlabel
  191.  If errorlevel 7 goto tn
  192.  If errorlevel 6 goto xtpro
  193.  If errorlevel 5 goto calculator
  194.  If errorlevel 4 goto launchpad
  195.  If errorlevel 3 goto word
  196.  If errorlevel 2 goto ozwin
  197.  If errorlevel 1 goto sidekick
  198.  goto end
  199.  
  200.  :sidekick
  201.  c:\utility\switchto sidekick
  202.  goto end
  203.  
  204.  :ozwin
  205.  c:\utility\switchto ozwin
  206.  goto end
  207.  
  208.  :word
  209.  c:\utility\switchtp "microsoft word"
  210.  goto end
  211.  
  212.  
  213.  
  214. (Part of batch file omitted to save length)
  215.  
  216.  :end
  217.  @echo on
  218.  
  219.  
  220.  
  221. 12.  When popup is activated via its hotkey, it automatically runs
  222. switch.com which allows me to select whatever other full screen or PM
  223. session that I have configured to jump to.  As I said before the popping
  224. up is so fast that I am unable to press the keys to popup and switch faster
  225. than the program can handle.  No waiting, instantaneous hotkeying from any
  226. full screen DOS session!!!
  227.  
  228. 13.  One last note.  For some reason switchtp doesn't like it if it is used
  229. in a full screen DOS session which has background processing turned OFF.
  230. You switch away O.K., but when you come back the DOS session's video will
  231. be corrupted.  This is completely solved by turning background processing
  232. ON.  (Note that switchtp works fine with background processing turned OFF
  233. for full screen windows sessions?  Go figure! <g>)
  234.  
  235.  
  236. 14.  You will note when using the switchto/switchtp programs as described
  237. above, that when you switch from one full screen program to another 
  238. full screen program that you are first brought to your desktop and then to
  239. the full screen program you are jumping to.  It works quite fast and is
  240. automatic, but if you don't like seeing the desktop momentarily during the
  241. switching process there is a way to go directly from one full screen 
  242. session to the next full screen session.  I've saved this for the end
  243. because it is optional and might confuse some, but isn't that hard really.
  244.  
  245. 15.  To jump directly from one full screen session to another you must use
  246. a program that allows you to start an OS/2 session in the background from a
  247. DOS or windows session.  Included with this file is a freeware OS/2 utility
  248. that works quite elegantly for this.  It is called OS2EXE.ZIP.  Inside 
  249. OS2EXE.ZIP are two programs OS2EXEC.EXE and OS2EXECD.EXE.  If you run any
  250. full screen windows sessions you need to load 2 copies of os2execd.exe from
  251. your startup folder.  Just create two different objects for os2execd.exe and
  252. make sure you select under the window settings tab that the object when run
  253. will run a NEW session of the program.  Also, make sure you put the -v switch
  254. on the parameters line of the settings notebook for these objects.  This will
  255. let you see more detail about how these programs work.  Once you have these
  256. programs working you can set them to run minimized, but at first don't 
  257. minimize them until you understand how things work and you have everything 
  258. working.
  259.  
  260. 16.  OS2EXEC.EXE is a DOS program that you run from your full screen DOS
  261. sessions.  What os2execd.exe does is open a named pipe that os2exec.exe or
  262. any program that can write to a file can communicate with.  What os2exec.exe
  263. does is pass through to os2execd.exe the name of a program to run.  
  264. Os2execd.exe then runs the program in the background.  Of course the program
  265. you tell it to run is switchto.  Switchto is run in the background and you 
  266. switch directly from one full screen session to another full screen session.
  267.  
  268. 17.  Here is an example of what the os2exec.exe lines in my switch.com file
  269. look like.  (Switch.com is discussed in detail above)
  270.  
  271.  :xtpro
  272.  c:\utility\os2exec.exe -x c:\utility\switchto.exe xtg
  273.  goto end
  274.  
  275.  :tn
  276.  c:\utility\os2exec.exe -x c:\utility\switchto.exe wintn
  277.  goto end
  278.  
  279. Note the use of the -x switch above.  The -x switch tells os2execd.exe to run
  280. the switchto program directly without invoking OS/2 cmd.exe first.
  281.  
  282. O.K. now you know how to setup direct hotkeying from a Full Screen DOS session
  283. to any other Full Screen session.  Now I will explain how to setup a Full
  284. Screen Windows Session.
  285.  
  286. 18.  Setting up a full screen windows session is a little trickier because
  287. you can't just launch os2exec.exe from windows.  If you do you will be
  288. switched to your desktop while OS/2 loads a DOS session and then runs the
  289. DOS program os2exec.exe.  This defeats the objective of jumping directly from
  290. a full screen windows session to another full screen session.
  291.  
  292. 19.  There is a solution however.  OS2EXECD.EXE will accept commands not just
  293. from os2exec.exe but from any program that can write to a file.  Therefore,
  294. what is needed is a windows program that can write to a file.  I use the 
  295. freeware windows 3.1 windows batch program called WINCMD.  WINCMD is again
  296. a PC Mag freeware utility written by Doug Boling.  It is available from Ziff
  297. on CompuServe and from Ziff's web site.  
  298.  
  299. For each full screen session that you might want to jump to from a full screen
  300. windows session you must configure a separate wincmd batch file.  Below is the
  301. wincmd batch file I use to switch from full screen windows to full screen
  302. Xtree Gold Pro.  I call it SXTG.WCM.  The WCM extension is required by the
  303. wincmd program.  The commands in SXTG.WCM file are exactly as follows:
  304.  
  305.  hfile = FileOpen(f:\pipe\os2exec.em,file_readwrite)
  306.  FileWrite(hfile,"00Xc:\utility\switchto.exe xtg")
  307.  delay(500)
  308.  FileWrite(hfile,"00A")
  309.  delay(500)
  310.  exit
  311.  
  312. What this windows batch file does is first open the named pipe file used by
  313. os2execd.exe.  Since OS/2 is on my F drive I use "f:\pipe\os2exec.em", you
  314. should substitute the letter of your OS/2 boot drive for f: in the line above.  
  315.  
  316. After opening the named pipe for read/write operations the next line
  317. writes to the named pipe "00Xc:\utility\switchto.exe xtg".  The 00X are
  318. special commands that os2execd.exe needs and should stay the same on your
  319. machine.  Substitute the appropriate drive and path to switchto.exe based
  320. upon where you keep switchto.exe on your computer.  Next the wincmd program
  321. pauses for 500 milliseconds.  Then it sends to the named pipe "00A" (That is 
  322. zero zero A) which tells os2execd.exe to reset the named pipe to await the 
  323. receipt of a new command.  Then the batch file pauses again for 500 
  324. milliseconds, and then it exits.  I found that the pauses were necessary to 
  325. get wincmd and os2execd.exe working together properly.
  326.  
  327. O.K. now that you have wincmd (or other windows program that can perform the
  328. above operations) setup and you have written your version of SXTG.WCM then all
  329. you have to do is follow the instructions above to assign a hotkey in windows
  330. that will launch wincmd.exe.  In this specific example it would launch 
  331. "wincmd.exe sxtg.wcm".  This runs wincmd.exe and tells wincmd.exe to run the
  332. windows batch file sxtg.wcm.  On my 486 120mhz computer this all takes place
  333. virtually instantaneously.  Then just write a separate *.wcm file for each
  334. full screen session you want to hotkey to from a full screen windows session.
  335. Then assign different hotkeys for each as detailed above.
  336.  
  337.  
  338. Well that's it.  This tells you all you need to know in order to hotkey from 
  339. any full screen DOS/windows session to any other full screen or PM session.
  340. This file was written and uploaded to share my experiences and to help others.
  341. I am not a programmer, but I have benefited from many other programmers 
  342. freeware and shareware programs.  This is my attempt at giving back something.
  343.  
  344. Cheers,
  345.  
  346. Gary Britt
  347. CompuServe ID 72073,2445
  348.