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

Re: A context-dependent tap

Expand Messages
  • ChrisDB
    ... Cool! Glad it worked out for you. Cheers - ChrisDB
    Message 1 of 5 , Feb 26, 2005
      thelms82000@... wrote (25 Feb 2005 10:55:47 -0000):
      >thank you, thank you, thank you
      >this trick opened up a new world of possibilities for me.

      Cool! Glad it worked out for you.
      Cheers - ChrisDB
    • David Ellis
      This is a great idea. I am trying to extend it to have a default behavior. So if an alias is not found for this context a default script is called. This is a
      Message 2 of 5 , Mar 30, 2005
        This is a great idea. I am trying to extend it to have a default behavior.
        So if an alias is not found for this context a default script is called.
        This is a way that works but it seem seems clumsy to me and has the
        downside of requiring that none of the scripts use the $0 variable. Another
        problem is that it requires each of the context sensitive scripts to set $0
        to 1 since this is how I tell that the line /X: /&script@ [$@] actually ran
        a script. Can any of you pScript gurus help to improve it?
        {contextA123::
        /&varSet@ [$A,@@cA@@]
        /K@
        /K4aA
        /$f
        /&varSet@[$0,0]
        /&ifGoTo@ [$$!=1000, @@X@@]
        /Pa
        /X: /&script@ [$@]
        /&script$[@@ADefault@@]
        }
        {ADefault::
        /* only run ADefault2 if a context script did not run
        /&ifScript@[$0==0,@@ADefault2@@]
        }
        {pnPRMessage::
        /* set $0 to 1 to indicate that a script ran */
        /&varSet[$0,1]
        /* this is where the stuff for 1100'pnPr goes */
        }
        {ADefault2::
        /* this is where the default stuff goes */
        }
        {cA1100'pnPr'dayView::ALIAS::pnPRMessage}

        Thanks ChrisDB for this great idea.

        Dave

        At 04:00 AM 12/10/2004, you wrote:

        >Here's a script for pToolSet which runs a different script of your choice
        >depending on which app ('creator ID') you are in, and also which view (or
        >'form') of that app is displayed.
        >Assign it to a tap and you've got a context-dependent tap!
        >Actually, it only uses the creator ID if the form ID is 1000 - cos so many
        >apps use this form ID. So it can't tell the difference between form ID 2200
        >(for eg) in two different apps.
        >I don't need it to, yet, but it can be easily modified. Let me know if you
        >have 'duplicate' form IDs other than 1000, and what apps are involved.
        >
        >1.First add this script to pScriptPad...
        >
        >pScript_05
        >/*change that number if you already use 05*/
        >{contextA::
        > /&varSet@ [$A,@@cA@@]
        > /K@
        > /K4aA
        > /$f
        > /&ifGoTo@ [$$!=1000, @@X@@]
        > /Pa
        >/:X /&script@ [$@]
        >}
        >
        >2.then add as many 'alias' entries as you want (anywhere in pScriptPad)
        >that have this syntax...
        >
        >{cA<form ID>'<creator ID>'<optional comment>::ALIAS::<script to run>}
        >
        >for example...
        >
        >{cA1000'date'dayView::ALIAS::dateDayViewIsolateEntry}
        >+ here the creator ID is date - which is the datebook app.
        >+ the form ID is 1000 - which is the day view.
        >+ the dayView bit is just an optional comment which the contextA script
        >ignores - it just helps you remember what 1000 means.
        >+ dateDayViewIsolateEntry is the script I want contextA to run in this
        >context.
        >
        >{cA1200'HZLt'mainView::ALIAS::HZLtTickWholePage}
        >+ here the creator ID is HZLt - which is the HandZipperLite app - however,
        >as the form ID is not 1000 this part is actually ignored by the contextA
        >script - but leave it in to remind yourself which app this relates to -
        >maybe you might want to put it in brackets not quotes to remind yourself
        >it's not actually used.
        >+ the mainView bit is just a comment which the contextA script ignores - it
        >just helps you remember what 1200 means.
        >+ HZLtTickWholePage is the script I want to be run in this context.
        >
        >{cA6613'pnTT'pads::ALIAS::scriptFindActual}
        >+ the creator ID here truly is just a reminder - this context is
        >magipad/scriptpad/editpad - which does not even report a creator ID to
        >pToolSet. I use pnTT cos they are located in the pTextTool.prc, which has
        >that ID. you could just as well write PADS if you want, and you could
        >replace HZLt above with HAND too if it made more sense to you - contextA
        >ignores the creator ID field of both - cos it's not 1000.
        >+ the pads bit is just the optional comment
        >+ unfortunately there's no way I know of to differentiate between editpad,
        >magipad & scriptpad, so you'll get the same result from contextA for all
        >three. As you can maybe guess from the name my script relates to scriptpad.
        >I don't have any magipad or editpad specific scripts really.
        >
        >3.How do I find the creator and form ID to make my 'alias' entries?
        >
        >use this script if you want...
        >
        >pScript_xx
        >{CIDandFormIDshow::
        > /K@
        > /Pa
        > /$f
        > /Ks
        >}
        >
        >4.More context taps/stroke/buttons/etc!
        >+ from the fact it's called contextA you probably guess what's comming
        >next...
        >
        >pScript_06
        >/*change that number as appropriate*/
        >{contextB::
        > /&varSet@ [$A,@@cB@@]
        > /K@
        > /K4aA
        > /$f
        > /&ifGoTo@ [$$!=1000, @@X@@]
        > /Pa
        >/:X /&script@ [$@]
        >}
        >
        >+ note the ONLY difference (except pScriptName) is the B on the /&varSet
        >line
        >+ and your alias entries for this one only have one difference too...
        >
        >{cB1000'date'dayView::ALIAS::dateDayViewConvert2toDo}
        >+ note the third char is B
        >+ this one happens in the same context as the first eg
        >
        >So you can have contexts A, B, C, D lined up at the top of the screen, or
        >whatever - enjoy :)
        >
        >5.can't get it going?
        >tell me - mlist.d@...
        >
        >6.todo
        >+ If I had time I'd love a script which just shows what all your context
        >taps will do in the current context. Anyone want to make it?
        >+ A script which make pastable 'alias' entries for you would be nice too
        >
        >cheers - ChrisDB
        >
        >ps. Of course couldn't be done prior to text kapturing feature (except via
        >/&ifScripts - didn't scale, got slower with each entry). Thanks to guy who
        >suggested (sorry, was who?) and of course Paul


        [Non-text portions of this message have been removed]
      • Tom Bress
        Here s my version of the context-dependent button pScript. I was able to eliminate pVariables by using /PA and /&ifScript@. Basically the pScript checks the
        Message 3 of 5 , Apr 4, 2005
          Here's my version of the context-dependent button pScript. I was able
          to eliminate pVariables by using /PA and /&ifScript@. Basically the
          pScript checks the number corresponding to the the creator ID. If the
          current app has the right ID the pScript automatically aborts and runs
          the dice rolling pScript roll2. If the creator ID is anything else
          the original pScript does not abort and performs the default action
          (launching 5N Launch in my case).

          As a bonus I added some context-dependent features to roll2 as well.
          In the Slapgammon program different forms can come up. These forms
          each have one control labelled either Done, Go! or Ok. The roll2
          pScript tries to toggle each one of these controls before simulating
          the tap that causes the dice to roll. Since the controls are mutually
          exclusive it behaves like a context-driven event. Now when I press
          the hard button that runs pScript_05 one of the following happens:

          If in Slapgammon on the main game page it rolls the dice
          If in one of the Slapgammon forms that require Done, Go!, or Ok it
          selects the appropriate control
          If not in Slapgammon it launches 5N Launch.

          pScript_05
          {contextA::
          /! /PA
          /&ifScript@ [$$==1397507917, @@roll2@@]
          /&launch [@@5N Launch@@]
          }

          {roll2::
          /&control[@@Done@@]
          /&control[@@Go!@@]
          /&control[@@Ok@@]
          /&tap i [117,70]}


          --- In peditors@yahoogroups.com, David Ellis <ddellis914@g...> wrote:
          > This is a great idea. I am trying to extend it to have a default
          behavior.
          > So if an alias is not found for this context a default script is
          called.
          > This is a way that works but it seem seems clumsy to me and has the
          > downside of requiring that none of the scripts use the $0 variable.
          Another
          > problem is that it requires each of the context sensitive scripts to
          set $0
          > to 1 since this is how I tell that the line /X: /&script@ [$@]
          actually ran
          > a script. Can any of you pScript gurus help to improve it?
          > {contextA123::
          > /&varSet@ [$A,@@cA@@]
          > /K@
          > /K4aA
          > /$f
          > /&varSet@[$0,0]
          > /&ifGoTo@ [$$!=1000, @@X@@]
          > /Pa
          > /X: /&script@ [$@]
          > /&script$[@@ADefault@@]
          > }
          > {ADefault::
          > /* only run ADefault2 if a context script did not
          run
          > /&ifScript@[$0==0,@@ADefault2@@]
          > }
          > {pnPRMessage::
          > /* set $0 to 1 to indicate that a script ran */
          > /&varSet[$0,1]
          > /* this is where the stuff for 1100'pnPr goes */
          > }
          > {ADefault2::
          > /* this is where the default stuff goes */
          > }
          > {cA1100'pnPr'dayView::ALIAS::pnPRMessage}
          >
          > Thanks ChrisDB for this great idea.
          >
          > Dave
          >
          > At 04:00 AM 12/10/2004, you wrote:
          >
          > >Here's a script for pToolSet which runs a different script of your
          choice
          > >depending on which app ('creator ID') you are in, and also which
          view (or
          > >'form') of that app is displayed.
          > >Assign it to a tap and you've got a context-dependent tap!
          > >Actually, it only uses the creator ID if the form ID is 1000 - cos
          so many
          > >apps use this form ID. So it can't tell the difference between form
          ID 2200
          > >(for eg) in two different apps.
          > >I don't need it to, yet, but it can be easily modified. Let me know
          if you
          > >have 'duplicate' form IDs other than 1000, and what apps are
          involved.
          > >
          > >1.First add this script to pScriptPad...
          > >
          > >pScript_05
          > >/*change that number if you already use 05*/
          > >{contextA::
          > > /&varSet@ [$A,@@cA@@]
          > > /K@
          > > /K4aA
          > > /$f
          > > /&ifGoTo@ [$$!=1000, @@X@@]
          > > /Pa
          > >/:X /&script@ [$@]
          > >}
          > >
          > >2.then add as many 'alias' entries as you want (anywhere in
          pScriptPad)
          > >that have this syntax...
          > >
          > >{cA<form ID>'<creator ID>'<optional comment>::ALIAS::<script to
          run>}
          > >
          > >for example...
          > >
          > >{cA1000'date'dayView::ALIAS::dateDayViewIsolateEntry}
          > >+ here the creator ID is date - which is the datebook app.
          > >+ the form ID is 1000 - which is the day view.
          > >+ the dayView bit is just an optional comment which the contextA
          script
          > >ignores - it just helps you remember what 1000 means.
          > >+ dateDayViewIsolateEntry is the script I want contextA to run in
          this
          > >context.
          > >
          > >{cA1200'HZLt'mainView::ALIAS::HZLtTickWholePage}
          > >+ here the creator ID is HZLt - which is the HandZipperLite app -
          however,
          > >as the form ID is not 1000 this part is actually ignored by the
          contextA
          > >script - but leave it in to remind yourself which app this relates
          to -
          > >maybe you might want to put it in brackets not quotes to remind
          yourself
          > >it's not actually used.
          > >+ the mainView bit is just a comment which the contextA script
          ignores - it
          > >just helps you remember what 1200 means.
          > >+ HZLtTickWholePage is the script I want to be run in this context.
          > >
          > >{cA6613'pnTT'pads::ALIAS::scriptFindActual}
          > >+ the creator ID here truly is just a reminder - this context is
          > >magipad/scriptpad/editpad - which does not even report a creator
          ID to
          > >pToolSet. I use pnTT cos they are located in the pTextTool.prc,
          which has
          > >that ID. you could just as well write PADS if you want, and you
          could
          > >replace HZLt above with HAND too if it made more sense to you -
          contextA
          > >ignores the creator ID field of both - cos it's not 1000.
          > >+ the pads bit is just the optional comment
          > >+ unfortunately there's no way I know of to differentiate between
          editpad,
          > >magipad & scriptpad, so you'll get the same result from contextA
          for all
          > >three. As you can maybe guess from the name my script relates to
          scriptpad.
          > >I don't have any magipad or editpad specific scripts really.
          > >
          > >3.How do I find the creator and form ID to make my 'alias' entries?
          > >
          > >use this script if you want...
          > >
          > >pScript_xx
          > >{CIDandFormIDshow::
          > > /K@
          > > /Pa
          > > /$f
          > > /Ks
          > >}
          > >
          > >4.More context taps/stroke/buttons/etc!
          > >+ from the fact it's called contextA you probably guess what's
          comming
          > >next...
          > >
          > >pScript_06
          > >/*change that number as appropriate*/
          > >{contextB::
          > > /&varSet@ [$A,@@cB@@]
          > > /K@
          > > /K4aA
          > > /$f
          > > /&ifGoTo@ [$$!=1000, @@X@@]
          > > /Pa
          > >/:X /&script@ [$@]
          > >}
          > >
          > >+ note the ONLY difference (except pScriptName) is the B on the
          /&varSet
          > >line
          > >+ and your alias entries for this one only have one difference
          too...
          > >
          > >{cB1000'date'dayView::ALIAS::dateDayViewConvert2toDo}
          > >+ note the third char is B
          > >+ this one happens in the same context as the first eg
          > >
          > >So you can have contexts A, B, C, D lined up at the top of the
          screen, or
          > >whatever - enjoy :)
          > >
          > >5.can't get it going?
          > >tell me - mlist.d@v...
          > >
          > >6.todo
          > >+ If I had time I'd love a script which just shows what all your
          context
          > >taps will do in the current context. Anyone want to make it?
          > >+ A script which make pastable 'alias' entries for you would be
          nice too
          > >
          > >cheers - ChrisDB
          > >
          > >ps. Of course couldn't be done prior to text kapturing feature
          (except via
          > >/&ifScripts - didn't scale, got slower with each entry). Thanks to
          guy who
          > >suggested (sorry, was who?) and of course Paul
          >
          >
          > [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.