home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / 1997 / 947 / TECHIE.TXT < prev   
Encoding:
Text File  |  1997-03-06  |  10.2 KB  |  288 lines

  1.                       PsiOn 1.4 Technical Guide
  2.                       -------------------------
  3.  
  4.   THIS FILE IS DATED 6th March 1997
  5.  
  6.   I've had a number of requests for changes to the program which are
  7.   useful functions in themselves, are a little too specialised or
  8.   would push the size of the program up beyond a reasonable limit.
  9.  
  10.   This isn't a comprehensive list - I just jotted down the easier
  11.   ones here. I'll TRY to keep it up-to-date and a copy of just this
  12.   file will be posted on the web page
  13.   http://www.hargreavesp.demon.co.uk
  14.  
  15.   Here are a couple of things you can do with PsiOn.  You will need
  16.   to be familiar with OPL to implement changes, and you'll need the
  17.   source for PsiOn installed on your computer.
  18.  
  19.   A >> at the beginning of a line shows the line I'm getting you to
  20.   change.
  21.  
  22.   -------------------------------------------------------------------
  23.   NEVER GIVE COPIES OF MODIFIED PsiOn CODE TO ANYONE !!
  24.   Make sure you have a copy of the original PsiOn code somewhere, as
  25.   you might find it difficult to debug if you haven't got anything to
  26.   compare against.
  27.  
  28.   You MUST quit the existing running PsiOn before compiling your
  29.   version. If you don't then it 
  30.  
  31.  
  32.   -------------------------------------------------------------------
  33.   1.  ALWAYS DO THIS CHANGE!!!
  34.  
  35.       Just do a replace on 1.4 and change 1.4 to 1.4Q. This way, if
  36.       someone writes to me about a problem they have, if the version
  37.       has a Q in it, I can ask for the source rather than me just
  38.       wandering around in the dark. Thanks!
  39.  
  40.  
  41.   -------------------------------------------------------------------
  42.   2.  Changing the Pause Time.
  43.  
  44.       Pause mode allows you to have PsiOn wait until 4am before
  45.       re-enabling your password. Here is how you can change that
  46.       time.
  47.  
  48.       Look for a section of code like this....
  49.  
  50.          REM Check if agenda will need attn
  51. >>       IF HOUR < 4
  52.             wakeagn% = 1: REM 1=go on alert, and always check time at
  53.          ENDIF
  54.  
  55.       And change the HOUR value to another hour. For example 7 for
  56.       7am in the morning.
  57.  
  58.       Next look for this section of code
  59.  
  60.          REM Start pause if required, or cancel if not
  61.          IF event%(1) = 624 OR event%(1) = %p :REM Psion-P (512 + 112
  62.             rearm& = srearm& :REM Restore default off time
  63.             IF pause% = 0
  64.                pause% = 1
  65.                REM Work out what 04:00 is on the next day
  66. >>             IF HOUR >= 4
  67.                   SECSTODATE DATETOSECS(YEAR, MONTH, DAY, HOUR, MINUT
  68.                ELSE
  69.                   SECSTODATE DATETOSECS(YEAR, MONTH, DAY, HOUR, MINUT
  70.                ENDIF
  71.  
  72. >>             rearmtm& = DATETOSEC
  73. S(event%(1), event%(2), event%(3),
  74. >>                4, 0, 0)  :REM This is one line in the real source
  75.                event%(1) = 0
  76.                CONTINUE :REM Around the while testevent again
  77.             ENDIF :REM Pause = 0
  78.          ENDIF :REM Event = 624
  79.  
  80.       And again, change the 4 to your new hour time.
  81.  
  82.       Now look for this last bit of code...
  83.  
  84.  
  85.          REM See if agenda needs looking at
  86.          IF currday% <> DAY
  87.             wakeagn% = 1 :REM 1=check time on turn on
  88.          ENDIF
  89. >>       IF ((wakeagn% <> 0 AND HOUR >= 4) OR agn% = 3) AND agn% > 1
  90.             wakeagn% = 2 :REM 2=Display agenda
  91.          ENDIF
  92.  
  93.       And again, change the 4 to your new hour time.  Now recompile
  94.       and run. When you next use the Pause mode, it will wait for
  95.       YOUR hour time and not 4am.
  96.  
  97.  
  98.   -------------------------------------------------------------------
  99.   3.  Reduce the Size of PsiOn.
  100.  
  101.       Currently, PsiOn is 1 byte of 3k. You can reduce it by a lot
  102.       (608 bytes) just by deleting one line of code!
  103.  
  104.       Look for the following code near the top of the program
  105.  
  106.          APP PsiOn
  107.             EXT "ODB"
  108.             PATH "\OPD"
  109. >>          ICON "\OPL\PSI-ON.ICO"
  110.             TYPE $1000
  111.          ENDA
  112.  
  113.       Remove the ICON line and re-translate. PsiOn will not have an
  114.       icon anymore, just a box above it. I'd suggest to put it in
  115.       a group list.
  116.  
  117.  
  118.   -------------------------------------------------------------------
  119.   4.  Run PsiOn from the RunOPO icon only.
  120.  
  121.       You can reduce the total size of PsiOn by even more (648 bytes)
  122.       by turning PsiOn into an OPO (just like "normal" translated
  123.       programs).
  124.  
  125.       Look for those first lines again
  126.  
  127. >>       APP PsiOn
  128. >>          EXT "ODB"
  129. >>          PATH "\OPD"
  130. >>          ICON "\OPL\PSI-ON.ICO"
  131. >>          TYPE $1000
  132. >>       ENDA
  133.  
  134.       and just Delete them. When you retranslate, you'll have a
  135.       Psi-on.opo in the OPO directory. Delete the copy of PsiOn you
  136.       put into APP, and run PsiOn from the RunOPO icon.
  137.  
  138.       NOTE : You MUST use the Psion-X or Psion-Escape keys to quit
  139.              PsiOn. If you ask it to quit using the System screen
  140.              (delete or Exit Application), then your passsword will
  141.              be left OFF rather than ON. This is due to OPO programs
  142.              not having any System events (like QUIT) sent to them.
  143.  
  144.  
  145.   -------------------------------------------------------------------
  146.   5.  Turning PsiOn into an APP.
  147.  
  148.       99% of OPA's can be happily renamed to APP's without any ill
  149.       effects. Just remember to remove the desktop icon before you
  150.       rename it and use the System screen to INSTALL it again
  151.       afterwards.
  152.  
  153.  
  154.   -------------------------------------------------------------------
  155.   6.  Controlling a program other than Agenda.
  156.  
  157.       PsiOn isn't limited to controlling Agenda - it can control any
  158.       program YOU can from the keyboard. There are limitations -
  159.       namely that certain programs do not have a Unique name as far
  160.       as SPY and PsiOn determine. If you look in SPY and find the
  161.       name begins with SYS$, then you should leave it alone.
  162.  
  163.       Look for the following code...
  164.  
  165.          REM Display agenda screen if required
  166.          IF wakeagn% = 2 :REM 2=Display now
  167.             wakeagn% = 0
  168. >>          text$ = "AGENDA" + CHR$(0)
  169.  
  170.        Just replace the "AGENDA" with the name of the other program.
  171.        Again - you'll need to use something like SPY to determine
  172.        what it should be.
  173.  
  174.        Next, you'll want to control which keys to send it. Currently,
  175.        PsiOn sends 2 different key combiniations (Psion-Space and
  176.        then Psion-Shift-View Key).
  177.  
  178.        Work out which keys you want to send. Write down if the Psion
  179.        key or Shift or Control needs to be sent as well.
  180.  
  181.        Then, use the following to convert them into combinations to
  182.        send.
  183.  
  184.        event%(2) holds the Shift, Psion and Control key combinations
  185.        using bool logic.
  186.  
  187.        Control is 4, Psion is 8 and Shift is 2.
  188.  
  189.        event%(1) hold the ASCII value of the key. If Psion is being
  190.        pressed at the same time, you should add 512 to this value.
  191.        (Most programs don't check the Flags part and just check if
  192.        512 has been added, so don't think you can just set the flag
  193.        value correctly).
  194.  
  195.        For example, to send just the character A
  196.           event%(2) = 0 :REM No flags
  197.           event%(1) = %A :REM Ascii A
  198.  
  199.        To send Shift-A
  200.           event%(2) = 2 :REM Shift
  201.           event%(1) = %A :REM Ascii A
  202.  
  203.        To send Psion-A
  204.           event%(2) = 8 :REM Psion
  205.           event%(1) = %A + 512 :REM Ascii A and 512 for Psion
  206.  
  207.        To Send Psion-Shift-A
  208.           event%(2) = 10 :REM Psion AND shift
  209.           event%(1) = %A + 512 :REM Ascii A and 512 for Psion
  210.  
  211.        I'm sure you get the idea.
  212.  
  213.  
  214.        Look for the following code (just below the "AGENDA" string)
  215.  
  216.           CALL($198d, 0, pid%) :gUPDATE :REM Now view agenda screen
  217.  
  218. >>        event%(2) = 4 :REM Control-Space - Move to today in Day vie
  219. >>        event%(1) = 32
  220. >>        CALL($0483, pid%, 49, 0, ADDR(event%()))
  221. >>
  222. >>        IF view$ <> "" AND view$ <> " " :REM Any other view wanted?
  223. >>
  224. >>           event%(2) = 10 :REM Send Key + 512(psion), and flags ( S
  225. >>           event%(1) = 512 + ASC(view$)
  226. >>           CALL($0483, pid%, 49, 0, ADDR(event%()))
  227. >>        ENDIF
  228.  
  229.        Note that the CALL lines are the ones that actually send the
  230.        keys.
  231.  
  232.        Delete this whole section of code. I'm assuming you DO want to
  233.        send different keys. Now replace it with your new keypresses.
  234.  
  235.        Here's an example. I've included the whole section of code
  236.        that I've been showing you. This example should call up
  237.        word if it's running, and will type a few chars into it. Then
  238.        it will call the spelling checker for the word. Not useful,
  239.        but it is an example ;)
  240.  
  241.          IF wakeagn% = 2 :REM 2=Display now
  242.             wakeagn% = 0
  243. >>          text$ = "WORD" + CHR$(0)
  244.             oscalls%(1) = $0100
  245.             oscalls%(2) = UADD(ADDR(text$), 1)
  246.             IF (OS($88, ADDR(oscall%())) AND 1)
  247.                pid% = oscalls%(1)
  248.  
  249.                CALL($198d, 0, pid%) :gUPDATE :REM Now view agenda scre
  250.  
  251.                event%(2) = 0 :REM Send new-line
  252.                event%(1) = 13
  253.                CALL($0483, pid%, 49, 0, ADDR(event%()))
  254.  
  255.                event%(2) = 0
  256.                event%(1) = %D
  257.                CALL($0483, pid%, 49, 0, ADDR(event%()))
  258.  
  259.                event%(2) = 0
  260.                event%(1) = %o
  261.                CALL($0483, pid%, 49, 0, ADDR(event%()))
  262.  
  263.                event%(2) = 0
  264.                event%(1) = %p
  265.                CALL($0483, pid%, 49, 0, ADDR(event%()))
  266.  
  267.                event%(2) = 8 :REM Psion key
  268.                event%(1) = %U + 512 :REM U + Psion key (Spell check)
  269.                CALL($0483, pid%, 49, 0, ADDR(event%()))
  270.  
  271.                event%(2) = 8 :REM Psion key
  272.                event%(1) = %W + 512 :REM W + Psion key (Check word)                
  273.                CALL($0483, pid%, 49, 0, ADDR(event%()))
  274.  
  275.             ENDIF :REM OS = 0
  276.          ENDIF :REM wakeagn% = 2
  277.  
  278.       You should get a list of words starting with dip, do, doe, dog,
  279.       don.
  280.  
  281.       Note : I haven't tested this code!
  282.  
  283.  
  284.   -------------------------------------------------------------------
  285.   7.  How to add Arm Now to a System hotkey so it can be accessed
  286.       from all screens.
  287.  
  288.       [Still figuring this one out!]