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

RE: [Clip] clipbook question: Name of document with focus

Expand Messages
  • Larry Thomas
    Hi Jason, ... This clip demonstrates how to get info on the current document using ^** and ^##. The difference between them is ^## returns the actual document
    Message 1 of 14 , Jun 24, 2000
    • 0 Attachment
      Hi Jason,

      At 12:00 PM 06/24/2000 -0700, you wrote:
      >Aha, found it in the help -- this must be it:
      >
      >^$GetDocName$
      >^$GetDocName(Index)$ (added in v4.52)
      >Returns the active document name, if no index is specified, or the document
      >name at specified index position. An invalid index number returns an empty
      >string. The first document is at index 1.
      >
      >
      >-----Original Message-----
      >From: Rush Family [mailto:rush@...]
      >Sent: Saturday, June 24, 2000 11:50 AM
      >To: ntb-clips@egroups.com
      >Subject: [Clip] clipbook question: Name of document with focus
      >
      >
      >
      >
      >Hi, this is probably a silly question but is there a built-in variable for
      >the filename of the document that currently has focus?
      >
      >I want a clip like:
      >
      >H="Debug the current script"
      >^!Perl -d $doc_with_focus$
      >
      >where $doc_with_focus$ is a perlscript that I want to send to the debugger.
      >
      >Or I might want to edit it in Notepad for some reason:
      >
      >H="Edit this thing in notepad for some reason"
      >^!Notepad $doc_with_focus$
      >
      >Thanks!
      >
      >Jason

      This clip demonstrates how to get info on the current document using ^**
      and ^##. The difference between them is ^## returns the actual document
      name and path (if the document has been saved). ^** does the same as ^##
      unless the document has been modified and the changes not saved. Then the
      temporary file name that begins with efo is given. When ever a new or
      existing document has text entered into it, NoteTab creates a temporary
      file beginning with the letters efo for that document in its home folder.
      When you save the changes the temporary file is deleted.

      ---------< start clip >---------
      H="Current Document Statistics"
      ;Larry Thomas <larryt@...>
      ;10/16/1999, 11:15:20 AM
      ^!Set %Fname%=Current Document: ^$GetFileName(^##)$^%nl%^%nl%
      ^!IfFileExist "^##" Next Else NoFile
      ;
      ;----------------------[begin long line]---------------------------
      ^!Append %Fname%=File Date/Time:
      ^$StrCopy("^$GetFileDate(^##)$";5;2)$/^$StrCopy("^$GetFileDate(^##)$";7;2)$/
      ^$StrCopy("^$GetFileDate(^##)$";1;4)$ /
      ;-----------------------[end long line]----------------------------
      ;
      ;
      ;----------------------[begin long line]---------------------------
      ^!Append
      %Fname%=^$StrCopy("^$GetFileTime(^##)$";1;2)$:^$StrCopy("^$GetFileTime(^##)$
      ";3;2)$:^$StrCopy("^$GetFileTime(^##)$";5;2)$
      ;-----------------------[end long line]----------------------------
      ;
      ;
      ;----------------------[begin long line]---------------------------
      ^!Append %Fname%=^%nl%File Path: ^$GetPath(^**)$^%nl%File Size:
      ^$GetFileSize(^##)$ Bytes / ^$Calc(^$GetFileSize(^##)$/1024)$kb^%nl%There
      are ^$GetLineCount$ Lines in this Document or Outline Topic.^%nl%(Word Wrap
      determines the Line Count.)^%nl^%nl%
      ;-----------------------[end long line]----------------------------
      ;
      ^!Goto TabInfo
      :NoFile
      ^!Append %Fname%=This is a new document and it has not been saved.^%nl%
      ^!If ^$GetFileSize(^**)$ < 1 TabInfo Else Next
      ;
      ;----------------------[begin long line]---------------------------
      ^!Append %Fname%=^%nl%File Size: ^$GetFileSize(^**)$ Bytes /
      ^$Calc(^$GetFileSize(^**)$/1024)$kb^%nl%There are ^$GetLineCount$ Lines in
      this Document or Outline Topic.^%nl%(Word Wrap determines the Line
      Count.)^%nl^%nl%
      ;-----------------------[end long line]----------------------------
      ;
      :TabInfo
      ;
      ;----------------------[begin long line]---------------------------
      ^!Append %Fname%=This document is number ^$GetDocIndex$ of ^$GetDocCount$
      open documents.
      ;-----------------------[end long line]----------------------------
      ;
      ;
      ;----------------------[begin long line]---------------------------
      ^!Append %Fname%=^p^pThe current date and time is:^p^p^$GetDate(dddd, mmmm
      d, yyyy, hh:mm:ss am/pm)$
      ;-----------------------[end long line]----------------------------
      ;
      ;
      ;----------------------[begin long line]---------------------------
      ^!SetWizardTitle ---------- Current Document
      Statistics ----------
      ;-----------------------[end long line]----------------------------
      ;
      ^!Info [L]^%Fname%
      ---------< end clip >-----------

      Regards,

      Larry
      larryt@...
    Your message has been successfully submitted and would be delivered to recipients shortly.