PsiOn 1.4 Technical Guide ------------------------- THIS FILE IS DATED 6th March 1997 I've had a number of requests for changes to the program which are useful functions in themselves, are a little too specialised or would push the size of the program up beyond a reasonable limit. This isn't a comprehensive list - I just jotted down the easier ones here. I'll TRY to keep it up-to-date and a copy of just this file will be posted on the web page http://www.hargreavesp.demon.co.uk Here are a couple of things you can do with PsiOn. You will need to be familiar with OPL to implement changes, and you'll need the source for PsiOn installed on your computer. A >> at the beginning of a line shows the line I'm getting you to change. ------------------------------------------------------------------- NEVER GIVE COPIES OF MODIFIED PsiOn CODE TO ANYONE !! Make sure you have a copy of the original PsiOn code somewhere, as you might find it difficult to debug if you haven't got anything to compare against. You MUST quit the existing running PsiOn before compiling your version. If you don't then it ------------------------------------------------------------------- 1. ALWAYS DO THIS CHANGE!!! Just do a replace on 1.4 and change 1.4 to 1.4Q. This way, if someone writes to me about a problem they have, if the version has a Q in it, I can ask for the source rather than me just wandering around in the dark. Thanks! ------------------------------------------------------------------- 2. Changing the Pause Time. Pause mode allows you to have PsiOn wait until 4am before re-enabling your password. Here is how you can change that time. Look for a section of code like this.... REM Check if agenda will need attn >> IF HOUR < 4 wakeagn% = 1: REM 1=go on alert, and always check time at ENDIF And change the HOUR value to another hour. For example 7 for 7am in the morning. Next look for this section of code REM Start pause if required, or cancel if not IF event%(1) = 624 OR event%(1) = %p :REM Psion-P (512 + 112 rearm& = srearm& :REM Restore default off time IF pause% = 0 pause% = 1 REM Work out what 04:00 is on the next day >> IF HOUR >= 4 SECSTODATE DATETOSECS(YEAR, MONTH, DAY, HOUR, MINUT ELSE SECSTODATE DATETOSECS(YEAR, MONTH, DAY, HOUR, MINUT ENDIF >> rearmtm& = DATETOSEC S(event%(1), event%(2), event%(3), >> 4, 0, 0) :REM This is one line in the real source event%(1) = 0 CONTINUE :REM Around the while testevent again ENDIF :REM Pause = 0 ENDIF :REM Event = 624 And again, change the 4 to your new hour time. Now look for this last bit of code... REM See if agenda needs looking at IF currday% <> DAY wakeagn% = 1 :REM 1=check time on turn on ENDIF >> IF ((wakeagn% <> 0 AND HOUR >= 4) OR agn% = 3) AND agn% > 1 wakeagn% = 2 :REM 2=Display agenda ENDIF And again, change the 4 to your new hour time. Now recompile and run. When you next use the Pause mode, it will wait for YOUR hour time and not 4am. ------------------------------------------------------------------- 3. Reduce the Size of PsiOn. Currently, PsiOn is 1 byte of 3k. You can reduce it by a lot (608 bytes) just by deleting one line of code! Look for the following code near the top of the program APP PsiOn EXT "ODB" PATH "\OPD" >> ICON "\OPL\PSI-ON.ICO" TYPE $1000 ENDA Remove the ICON line and re-translate. PsiOn will not have an icon anymore, just a box above it. I'd suggest to put it in a group list. ------------------------------------------------------------------- 4. Run PsiOn from the RunOPO icon only. You can reduce the total size of PsiOn by even more (648 bytes) by turning PsiOn into an OPO (just like "normal" translated programs). Look for those first lines again >> APP PsiOn >> EXT "ODB" >> PATH "\OPD" >> ICON "\OPL\PSI-ON.ICO" >> TYPE $1000 >> ENDA and just Delete them. When you retranslate, you'll have a Psi-on.opo in the OPO directory. Delete the copy of PsiOn you put into APP, and run PsiOn from the RunOPO icon. NOTE : You MUST use the Psion-X or Psion-Escape keys to quit PsiOn. If you ask it to quit using the System screen (delete or Exit Application), then your passsword will be left OFF rather than ON. This is due to OPO programs not having any System events (like QUIT) sent to them. ------------------------------------------------------------------- 5. Turning PsiOn into an APP. 99% of OPA's can be happily renamed to APP's without any ill effects. Just remember to remove the desktop icon before you rename it and use the System screen to INSTALL it again afterwards. ------------------------------------------------------------------- 6. Controlling a program other than Agenda. PsiOn isn't limited to controlling Agenda - it can control any program YOU can from the keyboard. There are limitations - namely that certain programs do not have a Unique name as far as SPY and PsiOn determine. If you look in SPY and find the name begins with SYS$, then you should leave it alone. Look for the following code... REM Display agenda screen if required IF wakeagn% = 2 :REM 2=Display now wakeagn% = 0 >> text$ = "AGENDA" + CHR$(0) Just replace the "AGENDA" with the name of the other program. Again - you'll need to use something like SPY to determine what it should be. Next, you'll want to control which keys to send it. Currently, PsiOn sends 2 different key combiniations (Psion-Space and then Psion-Shift-View Key). Work out which keys you want to send. Write down if the Psion key or Shift or Control needs to be sent as well. Then, use the following to convert them into combinations to send. event%(2) holds the Shift, Psion and Control key combinations using bool logic. Control is 4, Psion is 8 and Shift is 2. event%(1) hold the ASCII value of the key. If Psion is being pressed at the same time, you should add 512 to this value. (Most programs don't check the Flags part and just check if 512 has been added, so don't think you can just set the flag value correctly). For example, to send just the character A event%(2) = 0 :REM No flags event%(1) = %A :REM Ascii A To send Shift-A event%(2) = 2 :REM Shift event%(1) = %A :REM Ascii A To send Psion-A event%(2) = 8 :REM Psion event%(1) = %A + 512 :REM Ascii A and 512 for Psion To Send Psion-Shift-A event%(2) = 10 :REM Psion AND shift event%(1) = %A + 512 :REM Ascii A and 512 for Psion I'm sure you get the idea. Look for the following code (just below the "AGENDA" string) CALL($198d, 0, pid%) :gUPDATE :REM Now view agenda screen >> event%(2) = 4 :REM Control-Space - Move to today in Day vie >> event%(1) = 32 >> CALL($0483, pid%, 49, 0, ADDR(event%())) >> >> IF view$ <> "" AND view$ <> " " :REM Any other view wanted? >> >> event%(2) = 10 :REM Send Key + 512(psion), and flags ( S >> event%(1) = 512 + ASC(view$) >> CALL($0483, pid%, 49, 0, ADDR(event%())) >> ENDIF Note that the CALL lines are the ones that actually send the keys. Delete this whole section of code. I'm assuming you DO want to send different keys. Now replace it with your new keypresses. Here's an example. I've included the whole section of code that I've been showing you. This example should call up word if it's running, and will type a few chars into it. Then it will call the spelling checker for the word. Not useful, but it is an example ;) IF wakeagn% = 2 :REM 2=Display now wakeagn% = 0 >> text$ = "WORD" + CHR$(0) oscalls%(1) = $0100 oscalls%(2) = UADD(ADDR(text$), 1) IF (OS($88, ADDR(oscall%())) AND 1) pid% = oscalls%(1) CALL($198d, 0, pid%) :gUPDATE :REM Now view agenda scre event%(2) = 0 :REM Send new-line event%(1) = 13 CALL($0483, pid%, 49, 0, ADDR(event%())) event%(2) = 0 event%(1) = %D CALL($0483, pid%, 49, 0, ADDR(event%())) event%(2) = 0 event%(1) = %o CALL($0483, pid%, 49, 0, ADDR(event%())) event%(2) = 0 event%(1) = %p CALL($0483, pid%, 49, 0, ADDR(event%())) event%(2) = 8 :REM Psion key event%(1) = %U + 512 :REM U + Psion key (Spell check) CALL($0483, pid%, 49, 0, ADDR(event%())) event%(2) = 8 :REM Psion key event%(1) = %W + 512 :REM W + Psion key (Check word) CALL($0483, pid%, 49, 0, ADDR(event%())) ENDIF :REM OS = 0 ENDIF :REM wakeagn% = 2 You should get a list of words starting with dip, do, doe, dog, don. Note : I haven't tested this code! ------------------------------------------------------------------- 7. How to add Arm Now to a System hotkey so it can be accessed from all screens. [Still figuring this one out!]