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

Re: [Clip] passing external variables to a clip

Expand Messages
  • Tom Gudan
    Thanks, RS. Using your example as a guide, I wrote a FarClip that passes a variable back to the calling clip and it works fine. Tom
    Message 1 of 10 , Nov 21, 2000
    • 0 Attachment
      Thanks, RS.

      Using your example as a guide, I wrote a FarClip that passes a variable back to
      the calling clip and it works fine.

      Tom



      RS wrote:

      > Hi tpg,
      >
      > At 02:30 AM 11/18/00 -0000, you wrote:
      > >I need to pass external variables to a clip. By "external" I mean I
      > >can't use anything in NoteTab's folder, sub-folders, .ini file,
      > >Favorites, etc.
      > >
      > >I have other software that can use system variables as parameters.
      > >Under Windows NT, system variables are specified through Control
      > >Panel, then System, then Environment. With Windows 95, similar
      > >variables are specified through autoexec.bat by using the SET
      > >command. Can I access system variables within a clip?
      > >
      > >
      > >If not, please answer the following question:
      > >
      > >If a ^!FarClip issues a !Set command to assign data to a variable,
      > >can that variable then be used by the clip that issued the ^!FarClip
      > >command to obtain those data? If this is true, then it seems that I
      > >could use a ^!FarClip to provide external variables to regular clips.
      > >
      >
      > 1) With FarClip, all you need is:
      > ;======== Start ========
      > H="persist var"
      > ^!Set MyVar =QWERTY
      > ^!FarClip "MySecondLibrary:ShowValue"
      > ;========= End =========
      >
      > And in MySecondLibrary, the target clip:
      > ;======== Start ========
      > H="ShowValue"
      > ;This will show "QWERTY":
      > ^!Info ^%MyVar%
      > ;========= End =========
      >
      > 2) Now, if you want the value preserved even when libraries are changed
      > manually in the Clipbook, you must use a p_ variable. Variables prefixed by
      > "p_" are permanent, as far as you don't close the Clipbook:
      >
      > ;======== Start ========
      > H="persist var"
      > ^!Set p_MyVar =QWERTY
      > ^!FarClip "MySecondLibrary:ShowValue"
      > ;========= End =========
      >
      > ;======== Start ========
      > H="ShowValue"
      > ;This will show "QWERTY":
      > ^!Info ^%p_MyVar%
      > ;========= End =========
      >
      > 3) To pass a variable as a parameter to a clip:
      > ^!Clip DoSomething ^%MyVar%
      >
      > Then, in the DoSomething clip you get the value using ^&:
      > ^!Set MyParam =^&
      >
      > You can use the same technique with FarClip:
      > ;======== Start ========
      > H="persist var"
      > ^!Set p_MyVar =QWERTY
      > ^!FarClip "MySecondLibrary:ShowValue" ^%p_MyVar%
      > ;========= End =========
      >
      > ;======== Start ========
      > H="ShowValue"
      > ;This will show "QWERTY":
      > ^!Info ^&
      > ;========= End =========
      >
      > HTH,
      >
      > RS
      >
    • Tom Gudan
      Thanks, Craig. The SET command issued in the autoexec.bat (and its equivalent under Windows NT) is what I originally wanted. However, this time I was able to
      Message 2 of 10 , Nov 21, 2000
      • 0 Attachment
        Thanks, Craig.

        The SET command issued in the autoexec.bat (and its equivalent under Windows
        NT) is what I originally wanted. However, this time I was able to use a
        FarClip to accomplish the same thing (and I can change the variables it
        without a re-boot) but for future use I'll bear in mind that I can use ENV
        variables within a ^!Shell.

        Tom



        Craig wrote:

        > --- In ntb-clips@egroups.com, tpg@u... wrote:
        > > I need to pass external variables to a clip. By "external" I mean
        > I
        > > can't use anything in NoteTab's folder, sub-folders, .ini file,
        > > Favorites, etc.
        > >
        > > I have other software that can use system variables as parameters.
        > > Under Windows NT, system variables are specified through Control
        > > Panel, then System, then Environment. With Windows 95, similar
        > > variables are specified through autoexec.bat by using the SET
        > > command. Can I access system variables within a clip?
        > >
        > <snip>
        >
        > Howdy -
        > If you are running software that uses ENV variables, the simplest way
        > to set them to what you want is the SET command at the command line.
        > I have never gone the route of 'Control Panel', or any of Bill Gates'
        > other silliness for such things. Type 'set /?' for help on this.
        >
        > You should then be able to set what you want with ^!Shell in a clip,
        > and similarly run whatever app you just setup for.
        >
        > Hope that helps,
        > Craig
        >
      • Tom Gudan
        Thanks, Alan. You re right it is so much fun! Tom
        Message 3 of 10 , Nov 21, 2000
        • 0 Attachment
          Thanks, Alan.

          You're right it is so much fun!

          Tom



          Alan wrote:

          > --- In ntb-clips@egroups.com, tpg@u... wrote:
          > > I need to pass external variables to a clip. By "external" I mean
          > I
          > > can't use anything in NoteTab's folder, sub-folders, .ini file,
          > > Favorites, etc.
          > >
          > > I have other software that can use system variables as parameters.
          > > Under Windows NT, system variables are specified through Control
          > > Panel, then System, then Environment. With Windows 95, similar
          > > variables are specified through autoexec.bat by using the SET
          > > command. Can I access system variables within a clip?
          >
          > I experimented, the following works. But it works only for that (the 1
          > open console) console session. IOW you can use your Windows programs menu
          > and go from there to open the dos console (open a 2nd console window) and
          > the changes will not be effected therein. (it's in like manner to a windows
          > shortcut can have its own settings)
          >
          > Note: ^!Info is 2nd code line (The first code line, Set is one long line)
          >
          > ^!Set %bat%=^?[(H=22)choose one=="set
          > PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\"|"set
          > PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\;C:\PKWARE;D:\;D:\TEMP"|path=%path%;c:\misc;b:\;d:\install]
          > ^!Info ^%bat%
          > ^!Deletefile Doscmd.bat
          > ^!TextToFile "Doscmd.bat" @echo off^%nl%^%bat%
          > ^!Dos "Command.com /k" "doscmd.bat"
          > ;------<end of code<<
          >
          > I wonder what the /k switch is for?
          >
          > If you choose to trial the code, it will create C:\Program Files\NoteTab
          > Pro\Doscmd.bat (or whatever your path to your NoteTab exe directory)
          > (borrowed some from Larry T's DosLink clip).
          >
          > The first two wizard choices set the entire path. The third choice appends
          > onto an existing path.
          >
          > Must make sure you have all them drives and etc. or it will come up with
          > error (my B: drive is a Zip drive I had to insert a disk into the drive
          > before it all would work)
          >
          > ^!Command.com /k doscmd.bat also works as a replacement for the last
          > line of code.
          >
          > The only other way I found that would work was to first launch the console
          > then use keyboard command to keyboard everything in then ENTER (but that
          > was much slower since had to watch and wait for the clip to type)
          >
          > Guess a replacement for my ;------<end of code<< line could be some
          > keyboard commands to launch a console app. (instead of setting for
          > c:\pkware in my autoexec.bat I could append to path as above then run my
          > PkZip for DOS clip) Also could ^!ChDir at the very begining if need the
          > console prompt to come up at a certain directory.
          >
          > So much fun :-) Regards. Alan.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.