Loading ...
Sorry, an error occurred while loading the content.
 

Long conversation re: pscripting question

Expand Messages
  • hisimage8
    I ve pasted below a conversation that I ve been having with John which I started with a couple of questions to him a day or so ago. We thought that others who
    Message 1 of 37 , Dec 30, 2007
      I've pasted below a conversation that I've been having with John
      which I started with a couple of questions to him a day or so ago.
      We thought that others who are new to pscripting and pToolSet might
      like to see what I'm learning so I'm bringing this to the forum. Pat8

      John,

      I've seen your name quite a bit both here and on the peditors board.
      I'm just getting started trying to understand pscripts for my new
      treo 755p. I've tried this script which I run with a tap
      run pScript_00 {ds::/dm./dd./dy}
      which I thought would yield 2 digit month, day and year separated by
      a period but instead provides 2 digit month and day but 2007 as the
      year. Can you see what I've done wrong?

      >Hi Pat8. {ds::/dm./dd./dy} should give year as 07, not 2007, as
      you anticipated. Take a close look at your pScript and see if maybe
      the "Y" in "dy" somehow got entered as upper rather than lower case,
      so "dY". If it really is all lower case, "dy", I don't know what's
      happening, and would suggest a soft reset. I expect to have a 755p
      myself in a few days, but not yet, and so cannot test whether there
      is some glitch in the OS that responds to dy with the full year
      output.<

      Also, is it possible to run a script that would give me a soft reset
      so that I don't have to open up the back of my treo?

      >Since you are pScripting not limited to pedit you have pToolSet.
      Open the pMasterTool list, then menu/Act, and you'll see "Pin Reset"
      in the list. Activate that and you'll reset with the battery still
      in place. You could automate this with a pScript if you wish. If
      you want that, see if you can do it yourself and if you need help
      post back. Hint- you'd need that last item in the
      pMasterTool/menu/pMT2 list. Also there are several other apps that
      have a soft reset feature, for example LauncherX.<


      Also, is it possible to launch databases with a pscript like
      particular databases in HS2 or Bonsai?

      >Sometimes, but it can take a little manuvering and trial-and-
      error. For example, in Bonsai, your pScript would launch Bonsai,
      then go to the outline list by using "/xc E" (see the Bonsai
      menu/options/Outline List). Then you'd have to find which of the
      arrow up/down, 5-way up/down, or page up/down tokens work to move in
      the list - this can be variable from database to database with
      different apps. Also this implies that the item on the list is
      always going to be in the same location.<


      If you have time for help I'd really appreciate it. I'd be glad to
      move this to the forum peditor forum if you think that would be
      there and it appears a daunting job to me . . .

      Thanks,
      Pat8

      You are welcome. Maybe leave it on this forum for now so others
      can
      see what pScripting is about. . .

      ~ John


      >>Quoting John:


      >> Also, is it
      >> possible to launch databases with a pscript like particular
      databases
      >> in HS2 or Bonsai?




      > Sometimes, but it can take a little manuvering and trial-and-error.
      > For example, in Bonsai, your pScript would launch Bonsai, then go
      to
      > the outline list by using "/xc E" (see the Bonsai
      > menu/options/Outline List). Then you'd have to find which of the
      > arrow up/down, 5-way up/down, or page up/down tokens work to move
      in
      > the list - this can be variable from database to database with
      > different apps. Also this implies that the item on the list is
      > always going to be in the same location.

      I took a closer look at this Bonsai example and see that it is a
      great example of how tricky things can be (and thus how much fun from
      my point of view, but certainly not everyone's!). The reason I used
      "/xc E" is that in any given instance you don't know til you get
      there what state you've left Bonsai in, i.e. with a specific outline
      database open, or in the master outline list, or what. So I put in
      the command to go to the master list. But now I see that Bonsai uses
      the same command, "command-E", pScript token "/xc E", when the master
      list is open, to open the Export screen! So if you're in some other
      app and run your "open my Bonsai database for X" pScript, if you
      left Bonsai with some specific outline open it'll work as I
      anticipated, but if you left Bonsai the master list open the pScript
      will open the Export screen instead! Phooey. There is still a way to
      make it work, rather more complicated, and consequently more fun,
      involving using pScript tokens to determine which form (aka screen)
      identifier is current and then using "/&ifScript@[@@@@]" to proceed.
      If you want to pursue this one let me know.

      ~ John <<

      Quoting Pat8:
      >
      > I don't understand half of it yet but I'll try to find time this
      > afternoon to get to the treo and reread your notes with pda in hand.

      Couple other basics you need to know if you don't already, while
      you are on the Treo. Since you "run with a tap run pScript_00", that
      means to me that you know about the pToolSet Prefs screen and
      pScriptPad. That implies you also know how to deploy pMasterTool,
      yes? However, you may not be aware of some recent features Paul has
      added to pToolSet for Treo users. First (and not really a new
      feature) since the Treos don't show a control bar (unless you use
      Butler or 2LaunchMe), you can't launch the pMasterTool list with the
      control bar p-house icon. Best way is either to use a screen tap, or
      a button hold'n'hold, or, possibly best of all, use either lower-
      case "z" or "q", or the period "." for your pMasterTool ESC key. To
      do this, open pToolPrefs and put one of those characters in the
      highlighted spot to the right of "use ESC (escape) key", and check to
      box. Now when you press the characterr you selected it will open
      pMasterTool. To use the key to write the character in text you press
      it twice in succession, so "zz" prints the letter z, for example.
      Now, if you open the pMasterTool list and tap or select menu, or tap
      the header of whatever is in the background, you'll get the
      pMasterTool dropdown menus. Open "Opt" and select Low-Case ListNav
      Fix on|off" so that it is on. Now the first 26 items in the pMaster
      Tool will be identified by lower-case letters, making it very easy to
      deploy them with the keyboard, since now if you just type
      your ESC character followed by the letter for the item you want,
      it'll open. Example, if your ESC is "z" and pScriptPad is designated
      by "p", keying zp will open it, bingo! Finally, if you select pMT1
      in the pMaterTool menus, then pMasterToolPrefs, you can sort your PMT
      list any Way you want. I've put mine in a sort of alpha order, so
      pAsciiTool is a, pScriptButtons is b, copy text is c, etc.

      If you are already aware of these items, my apologies, just don't
      know how far you've gotten and maybe can save you some hunting around.

      ~ John <<

      John,

      I've owned and used pToolSet and peditPro for years but haven't done
      anything beyond, years ago, setting up that one date script
      (mentioned in the original question) and pFindTool mapped to my Find
      button. I wouldn't even have known how to set up the date script
      again except that I'd entered it into a memo years ago and I could
      use "Find" to find it again. Even then it took me awhile to remember
      that I had to open peditPro to find the scriptpad. Please assume
      lots of ignorance because even if I knew something once I've
      forgotten it, most likely, and perhaps it will help others as well.

      Anyway, I've set up "z" as my escape key and am going to work on move
      things around on the list, as you suggested, so that I can get to
      things more intuitively. I was trying to map everything to taps but
      I believe this will be faster for me. Thanks for shortening my
      learning time and thanks, too, for assuming that I don't know very
      much yet.

      As to the original question about the date. I had this:
      {ds::/dM./dD./dy}
      in my scriptPad two lines before this:
      run pScript_00 {ds::/dm./dd./dy}

      I deleted the first line and now get the date as I
      expected. "12.30.07", for instance. Does this mean that the first
      line in pscriptPad is being run as pScript_00 and that I don't have
      to put "run pScript_xx" before whatever script I'm entering?

      Also, I do want to pursue trying to launch a database in Bonsai and
      also one in HS2. I get into these two databses frequently and am
      looking for an easier way than all the tapping. I won't be back to
      this until this afternoon or evening but I'll start with what you've
      given me so far and come back with questions.

      By the way, I'm new to my Treo, having used a T3 for many years. I
      do have both Butler and Reset Doctor as I've already found problems
      with seemingly spontaneous resets. I remember that you mentioned you
      were waiting for a 755p. If you've had a Treo before, it is normal
      to have a "flushing cache" message stop your machine 4 or 5 times a
      day?

      Pat8
    • John Markley
      ... Super! Isn t this fun?? ... OK, I guessed as much and just finished the looong post below. First are the two pScripts for Bonsai that I think will work
      Message 37 of 37 , Feb 10, 2008
        > YES!! That works for both WalMart (which is first position) and
        > Errands (which is second position).
        >

        Super! Isn't this fun??

        > In Bonsai aFamily Information is first and aWeekly Agenda is second.
        >

        OK, I guessed as much and just finished the looong post below. First
        are the two pScripts for Bonsai that I think will work right off. They
        work on the position-in-index principle, so the one for aFamily
        Information will in fact open whatever is first. Following those two
        I've put position-in-index versions of the HS2 pScripts on the
        assumption that *Errands is first and **Walmart is second. Since what
        you have right now for HS2 is working you probably won't want to
        change, but if you do, there they are. Then finally, below the line of
        asterisks********** I've put all four pScripts again, but with
        pComment annotations so you can figure out how to alter them if you
        ever need to.

        Here you go --

        custBtn.001.3
        pScript_13
        {aFamily Information::
        /&launch[@@Bonsai@@]
        /&script$[@@Fam1@@]}
        {Fam1::
        /!/$f
        /&varSet@[$8,$$]
        /&ifScript@[$8!=1000,@@Fam2@@]
        /&ifScript@[$8==1000,@@Fam3@@]}
        {Fam2::
        /xc E /&script$[@@Fam3@@]}
        {Fam3::
        /&varSet@[$1,1]
        /:Z/0x1E
        /&varAdd@[$1,1]
        /&ifGoTo@[$1<17,@@Z@@]
        /xn}




        custBtn.001.4
        pScript_14
        {aWeekly Agenda::
        /&launch[@@Bonsai@@]
        /&script$[@@Weekly1@@]}
        {Weekly1::
        /!/$f
        /&varSet@[$8,$$]
        /&ifScript@[$8!=1000,@@Weekly2@@]
        /&ifScript@[$8==1000,@@Weekly3@@]}
        {Weekly2::
        /xc E /&script$[@@Weekly3@@]}
        {Weekly3::
        /&varSet@[$1,1]
        /:Z/0x1E
        /&varAdd@[$1,1]
        /&ifGoTo@[$1<17,@@Z@@]
        /0x1F
        /xn}


        custBtn.001.1
        pScript_11
        {*Errands::
        /&launch[@@HandyShop2@@]
        /&script$[@@Errands1@@]}
        {Errands1::
        /xc E /0x0D
        /0x0D}


        custBtn.001.2
        pScript_12
        {**WalMart::
        /&launch[@@HandyShop2@@]
        /&script$[@@WalMart1@@]}
        {WalMart1::
        /xc E /0x0D
        /0x0C
        /0x0D}





        *******annotated with pComments /*comment*/ --


        custBtn.001.1
        pScript_11
        {*Errands::
        /&launch[@@HandyShop2@@]
        /&script$[@@Errands1@@]}
        {Errands1::
        /xc E /*command E goes to Database list*/
        /0x0D /*carriage return puts selection focus on first item*/
        /0x0D} /*carriage return opens selected item*/


        custBtn.001.2
        pScript_12 /*same as pScript_11 except for /0x0C below*/
        {**WalMart::
        /&launch[@@HandyShop2@@]
        /&script$[@@WalMart1@@]}
        {WalMart1::
        /xc E /0x0D
        /0x0C /*page down, moves selection down one, to second item. Down
        arrow, 0x1F, does not work in this situation*/
        /0x0D}


        custBtn.001.3
        pScript_13
        {aFamily Information::
        /&launch[@@Bonsai@@]
        /&script$[@@Fam1@@]}
        {Fam1::
        /!/$f /* ! prevents $f from printing, $f sets $$ to form ID number*/
        /&varSet@[$8,$$] /*sets pVariable $8 to the form ID of the current form*/
        /&ifScript@[$8!=1000,@@Fam2@@] /*if the form is not ID 1000, go to Fam2*/
        /&ifScript@[$8==1000,@@Fam3@@]}/*if form is ID 1000, go to Fam3*/
        {Fam2::
        /xc E /* command E, close currently open list, go to database index*/
        /&script$[@@Fam3@@]}
        {Fam3::
        /&varSet@[$1,1] /*set pVariable $1 to have a value of 1*/
        /:Z/0x1E /*GoTo anchor Z, followed by up arrow*/
        /&varAdd@[$1,1] /*add one to pVariable $1*/
        /&ifGoTo@[$1<17,@@Z@@] /*if $1 is less than 17, go back to Z, repeat*/
        /xn} /*when $1 has reached 17, carriage return to open the now
        activated top item*/

        Further explanation - In HandyShopper command-E ("/xc E") does the same
        thing whether the database index or one of the lists is open, so the
        "/!/$f" is not needed. But in Bonsai, if an outline is still open when
        the pScript opens Bonsai command-E will close it and display the
        outline list (database index), but if Bonsai was left in the outline
        list last time around command-E gives the command to Export; not good.
        The form ID 1000 is the form for the database index list of outlines
        (if you want to know how to find this out it's in the manual, or ask
        me). So this pScript says, ok, what form am I in? If it's an open
        outline, not form 1000, close it and go to the database index using /xc
        E. If it is already in the index, form ID 1000, proceed without /xc E.
        Then, unlike in HandyShopper where the topmost item can be selected
        immediately and reproduceably always, using /0x0D, this does not work
        in Bonsai. In Bonsai the outline list always has whatever outline name
        was last used highlighted. So this pScript moves the selection upward
        17 times. This ensures that even if you last used your lowest on the
        list #15, the selection will now be on the top, #1. If you ever exceed
        17 items in Bonsai you will need to increase the number in
        "/&ifGoTo@[$1<17,@@Z@@]" accordingly. In this pScript, /xn then
        activates the selected top item. To get item #2, the "aWeekly Agenda"
        pScript adds "0x1F", arrow down, to move the selection down one, from
        item 1 to item 2, then opens it. Unlike in HS2, 0x1F works rather than
        0x0C.




        custBtn.001.4
        pScript_14
        {aWeekly Agenda:: /*same as aFamily Information except /0x1F*/
        /&launch[@@Bonsai@@]
        /&script$[@@Weekly1@@]}
        {Weekly1::
        /!/$f
        /&varSet@[$8,$$]
        /&ifScript@[$8!=1000,@@Weekly2@@]
        /&ifScript@[$8==1000,@@Weekly3@@]}
        {Weekly2::
        /xc E /&script$[@@Weekly3@@]}
        {Weekly3::
        /&varSet@[$1,1]
        /:Z/0x1E
        /&varAdd@[$1,1]
        /&ifGoTo@[$1<17,@@Z@@]
        /0x1F /* arrow down*/
        /xn}


        Cheers, John
      Your message has been successfully submitted and would be delivered to recipients shortly.