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

Clip to create a file

Expand Messages
  • Marcus
    I would like to write a clip using an input wizard which will let me create a file and save it to disk using the filename input by the user. Can I do this with
    Message 1 of 5 , May 14, 2001
    • 0 Attachment
      I would like to write a clip using an input wizard which will let me
      create a file and save it to disk using the filename input by the user.

      Can I do this with a wizard, and if so, can you give me some pointers
      or an example of how to do it, or has someone already written something
      similar that I can use as an example.

      Basically, I need to collect some input and then write it all to a
      file.

      2) I also need to collect directory paths to the NTB libraries folder,
      and others I would let the user browse to. How best to browse and store
      the paths for future use by the clip?

      Any help would be greatly appreciated.

      Thank You and Happy Clippin'

      Marcus
    • Jim Hall
      Marcus, ... In NoteTab go to TOOLS|QUICK LIST PROPERTIES| and select Clip Assistant and you will find help (in the Quick List window on the right side of the
      Message 2 of 5 , May 14, 2001
      • 0 Attachment
        Marcus,

        At 07:23 PM 5/14/2001, you wrote:
        >I would like to write a clip using an input wizard which will let me
        >create a file and save it to disk using the filename input by the user.
        >
        >Can I do this with a wizard, and if so, can you give me some pointers
        >or an example of how to do it, or has someone already written something
        >similar that I can use as an example.
        >
        >Basically, I need to collect some input and then write it all to a
        >file.
        >
        >2) I also need to collect directory paths to the NTB libraries folder,
        >and others I would let the user browse to. How best to browse and store
        >the paths for future use by the clip?

        In NoteTab go to TOOLS|QUICK LIST PROPERTIES| and select Clip Assistant and
        you will find help (in the Quick List window on the right side of the
        NoteTab screen) on creating clips which use wizards, including wizards
        which allow browsing.

        Also, the Clip Assistant uses wizards to get input to create Clips and the
        Clip Assistant text can be viewed if you open C:\Program Files\NoteTab
        Pro\ClipHelp.clh

        The Wizard of NoteTab wizards is Jody. If there was ever a wizard written
        he probably wrote it or in some way helped write it and probably has a copy
        of every one ever written.<G>

        He probably has exactly what you are looking for and hopefully he will
        reply and tell you where to find it.

        Hope this helps

        Jim (Who has never written even one wizard)
      • dido7@juno.com
        ... Hope this helps Jim (Who has never written even one wizard) (Bro.) Dido
        Message 3 of 5 , May 14, 2001
        • 0 Attachment
          >>
          Hope this helps

          Jim (Who has never written even one wizard)
          <<

          LOL!!!!

          I liked that! Thanks. <g>

          (Bro.) Dido


          On Mon, 14 May 2001 21:55:19 -0700 Jim Hall <jehall@...> writes:
          > Marcus,
          >
          > At 07:23 PM 5/14/2001, you wrote:
          > >I would like to write a clip using an input wizard which will let
        • Stephen
          Hi Marcus, In the library depository, there are scads and scads of clips using these things, and Jody has a library called DirStuff which has more examples
          Message 4 of 5 , May 15, 2001
          • 0 Attachment
            Hi Marcus,
            In the library depository, there are scads and scads of clips using
            these things, and Jody has a library called DirStuff which has more
            examples than either of us could digest this year.
            Here's what I know:

            >I would like to write a clip using an input wizard which will let me
            >create a file and save it to disk using the filename input by the user.

            In your clip, simply ask for the filename. (Good idea to give a default,
            usually some variation of a date so there's a good chance of not
            overwritting pre-existing files.)
            Then use the command
            ^!Save As whatevername.whateverextension.
            this part of the clip in a long and therefore hard to read line could
            look like this:
            ^!Save As^?{What name do you want to Save this file
            as=whatevername^$GetDate(yyyymmdd)$}^?{What extension=.txt}
            [Note that when using dynamic data, the wizard prompt must come from the
            {} command and not the [] command.
            >2) I also need to collect directory paths to the NTB libraries folder,
            >and others I would let the user browse to. How best to browse and store
            >the paths for future use by the clip?

            Note Tab has an assortment of built-in functions which describe the
            libraries path, the favorites path, the documentspath and the
            applicationpath.
            In a clip you can use a parameter to (T=D) to specify a directory.
            Using the Note Tab libraries libraries folder as default, the clip line
            could look like this.
            ^!Save As ^?{(T=D)Choose a directory=^$GetLibraryPath$}

            Saving any of these variables gives you three options.
            1: Any clip variable is valid until the clipbook is closed or it is
            overwritten. That's why some people start their clips with a clear
            variables command, old variables might be called by the new clip. It
            also lets you use the values of one clip in another, similiar to a
            function call in other scripting languages.

            2: If you start a variable name with a p underline, it is stored as long
            as Note Tab is open , even if you shuffle through the variables:
            ^!Set %P_something%=TURKEYS

            3: You can save any value in the ini file. You do not even have to call
            it a variable.
            ^!Save experiments=Turkeys
            ^!Save %P_something%=TURKEYS

            In order to not clutter up the NoteTab.ini, you might use a command to
            store the values in special ini file:

            ^!SetIniFile experimental.ini

            To acces any values saved there, use this command:
            ^!GetValue experimental


            I spent some time re-creating the wheel in a couple of clips. I had
            used most of these commands before, but not all of them together, and
            not with a clip library file as default, so I came up with these two
            clips to demo the commands (If you use them, watch for lines that have
            been word wrapped by our ever-lovin applications):

            H="Addresses Database"
            ^!ClearVariable %output%
            ^!Set %savepath%=^?{(T=D)What directory do you wish to save this
            document in?=^$GetLibraryPath$}; %savename%=^?{What do you wish to call
            this file=addresses}; %saveext%=^?{What extension do you wish to save it
            as=.clb}; %append%=^?{If this file already exists, what do you wish to
            do?=_Append this file to the previous one^=append|Overwrite the previous
            file^=overwrite}; %ini%=^?{Save this in the addresses.ini?==Yes|_No};
            %about%=^?{(T=W)About This Clip=This clip will create a simple address
            and phone number database. ^PBy default, it adds the value you enter
            into a unique clip library, but you may append the values to any library
            you wish. ^PYou also have the option of storing these values in the
            addresses.ini file. }
            :startworking
            ^!If ^$GetFileDate(^%savepath%^%savename%^%saveext%)$<1 NEXT ELSE SKIP
            ^!Set %append%=overwrite
            ^!IfSame ^%append% overwrite NEXT ELSE SKIP
            ^!Append %output%="= V5 MultiLine TabWidth=30^%NL%"
            ^!SetIniFile ^$GetAppPath$addresses.ini
            :namesloop
            ^!Set %name%=^?{What is the person's name?=John Doe}; %street%=^?{What
            is their street address=123 Some Street}; %city%=^?{What is their
            city?=anytown}; %state%=^?{What state do they live in?=noplace};
            %zip%=^?{If in USA, what is their zip?=}; %country%=^?{What is their
            country?=nowhere}; %phone%=^?{What is their phone number?};
            %email%=^?{What is their email address?}; %web%=^?{What is their
            web-site URL?}; %more%=^?{Are there more addresses to add==Yes|_NO}
            ^!Append %output%="^%NL%^%NL%H="^%name%"^%NL%"
            ^!Append
            %output%=^%name%^%NL%^%street%^%NL%^%city%^%SPACE%^%state%^%SPACE%^%SPACE%^%zip%^%NL%^%NL%
            ^!Append
            %output%=^%NL%^%TAB%^%phone%^%NL%^%TAB%^%email%^%NL%^%TAB%^%web%^%NL%^%NL%
            ^!IfSame ^%ini% YES NEXT ELSE endini
            ^!SaveValue Addresses:^%name%=^%street%,^%city%, ^%state% ^%zip%
            ^%country%
            ^!SaveValue Emails:^%name%=^%email%
            ^!SaveValue PhoneNumbers:^%name%=^%phone%
            ^!SaveValue HomePages:^%name%=^%web%
            ^!Set %allnames%=^%name%|^$GetValue("Names:List")$
            ^!SaveValue Names:List=^$StrSort("^%allnames%";TRUE;TRUE;TRUE)$
            :endini
            ^!IfSame ^%more% Yes namesloop ELSE NEXT
            ^!IfSame ^%append% overwrite NEXT ELSE SKIP
            ^!DeleteFile "^%savepath%^%savename%^%saveext%"
            ; I'm not using the ^!Save As command because it is not really needed.
            ^!AppendToFile "^%savepath%^%savename%^%saveext%" ^%output%
            ; Reset back to the original Ini file
            ^!SetIniFile


            H="Get Addresses Ini Values"
            ^!SetIniFile ^$GetAppPath$addresses.ini
            ^!SetListDelimiter |
            ^!Set %who%=^?{(T=A)Choose whose data you wish to
            retrieve=^$GetValue("Names:List")$}; %data%=^?{(T=A)What data do you
            wish to retrieve=Addresses|_PhoneNumbers|Emails|HomePages}
            ^!SetArray %who%=^%who%
            ^!SetArray %data%=^%data%
            ^!Set %output%=^%EMPTY%; %i%=1; %inneri%=1
            :outloop
            ^!Set %nowwho%=^%who^%i%%
            ^!Append %output%=^%who^%i%%^%NL%
            :inloop
            ^!Append %output%=^$GetValue("^%data^%inneri%%:^%nowwho%")$^%NL%
            ^!Inc %inneri%
            ^!If ^%inneri%>^%data0% NEXT ELSE inloop
            ^!Set %inneri%=1
            ^!Inc %i%
            ^!If ^%i%>^%who0% NEXT ELSE outloop
            ^%output%




            Hope this helps, and is not too much detail or anything, but it was lots
            of fun.
            Stephen
          • Jody
            Hi Jim and Marcus, ... You will probably want to use braces instead of brackets with these, especially if the Save command follows other scripting code. ^!Save
            Message 5 of 5 , May 15, 2001
            • 0 Attachment
              Hi Jim and Marcus,

              >> I would like to write a clip using an input wizard which will
              >> let me create a file and save it to disk using the filename
              >> input by the user.

              You will probably want to use braces instead of brackets with
              these, especially if the Save command follows other scripting code.

              ^!Save ^?[Save focused document as]
              ^!Save ^?[(T=S)Save focused document as]
              ^!Save As ^?[Save focused document as]
              ^!Save As ^?[(T=S)Save focused document as]

              >> 2) I also need to collect directory paths to the NTB libraries
              >> folder, and others I would let the user browse to. How best to
              >> browse and store the paths for future use by the clip?

              ^!Save As ^?{Save focused document as=^$GetLibraryPath$FileName.clb}

              (T=S) lets you browse, but you cannot use a function like above with it.

              >The Wizard of NoteTab wizards is Jody. If there was ever a wizard
              >written he probably wrote it or in some way helped write it and
              >probably has a copy of every one ever written.<G>

              Thanks Jim, but there are surely others out there that write more
              complex scripts than I do.

              >Jim (Who has never written even one wizard)

              I don't knowingly write witches either. ;)


              Happy Clip'n!
              Jody

              http://www.notetab.net

              Subscribe, UnSubscribe, Options
              mailto:Ntb-Clips-Subscribe@yahoogroups.com
              mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
              http://www.egroups.com/group/ntb-clips
            Your message has been successfully submitted and would be delivered to recipients shortly.