Browse Groups

• Hi everbody I m trying to create a clip that determines if an entry in a tab delimited file is greater than 7 days old I came up with this, but this stores the
Message 1 of 20 , Oct 2, 1999
View Source
Hi everbody

I'm trying to create a clip that determines if an entry
in a tab delimited file is greater than 7 days old
I came up with this, but this stores the date as
three separate fields and it isn't completly accurate.

;year month day
1999 9 27

^!Set %today%=^\$Calc((^\$GetDate(yyyy)\$ * 365)+((^\$GetDate(m)\$ -1) *
30)+(^\$GetDate(d)\$))\$
-1) * 30)+(^\$GetField(-1;3)\$))\$
^!If ^\$Calc(^%today% - ^%day_added%)\$ < 7 NEXT SKIP_1
^!Set %isnew%=yes
^!Set %isnew%=no

My question:

Is there a way to determine how many days old a given
date is without converting it to number of days
after Divinity?

Thanks for any assistance.

Steve
stevendb@...
• Hi Steven, ... I really don t have much to add, except I attempted to make it accurate. However, it is too late for this ignernt hillbilly to be messing with
Message 1 of 20 , Oct 13, 1999
View Source
Hi Steven,

> Is there a way to determine how many days old a given date is
> without converting it to number of days after Divinity?

I really don't have much to add, except I attempted to make it
accurate. However, it is too late for this ignernt hillbilly to
be messing with stuff he doesn't know about so, you better check
my math. <g> You'll also have to account for leap years and year
2000 when you have to roll it back to 1900. :) OH, but NoteTab
*is y2k compliant*, not just ready. haha

Field two, your month, is used in the array to get the number of
days-1 up to that month, but not including it. The rest of the
days + year*365 you did already. I just paced the arrays results
where get field two was and added Jan plus subtracted the day in
it). Watch out for the long ^!Set lines.

H=Is Date Older
; Steve, stevendb@...
; year month day
; 1999 9 27

^!If ^\$GetField(-1;2)\$ = 1 DoJan
^!SetArray %Days%=00;30;58;89;120;150;181;212;242;273;303;334
^!Set %ListMonth%=^\$GetField(-1;2)\$
^!Set %SubDays%=^%MonthDays^%ListMonth%%
^!Goto Calc

:DoJan

:Calc
^!Set %today%=^\$Calc((^\$GetDate(yyyy)\$ * 365)+(^\$GetDate(m)\$ * 30)+(^\$GetDate(d)\$))\$

^!Set %day_added%=^\$Calc((^\$GetField(-1;1)\$ * 365)+(^\$GetField(-1;2)\$ * 30)+(^\$GetField(-1;3)\$))\$
^!If ^\$Calc(^%today% - ^%day_added%)\$ < 7 NEXT SKIP
^!Set %isnew%=yes
^!Set %isnew%=no
^!Info ^%isnew%

Happy Clip'n!
Jody

http://www.sureword.com/notetab

The NoteTab Clip List...
mailto:Ntb-Clips-Subscribe@...
mailto:Ntb-Clips-UnSubscribe@...
• Message 1 of 20 , Nov 4, 1999
View Source

• Hi, I checked the online clip repository and was unable to find any clip for what I need to do. Before I go building a new one, I felt best to ask if someone
Message 1 of 20 , Nov 7, 1999
View Source
Hi,

I checked the online clip repository and was unable to find any clip for
what I need to do. Before I go building a new one, I felt best to ask if

I need a clip to gather information on all files and paths to those files
and direcotries within a directory. So I basically need it to move through
the directory hierarchy gathering and storing information on files and
directories. BTW, there will be more than 40,000 files and directories it
will keep track of...

The part of the script that i will have the most problem with is actually
moving through the directory structure... any help is appreciated...

Dennis
*********************************************************************

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
partridge@...
*********************************************************************

Dennis N. Partridge
partridge@...

The SurnameWeb
http://www.surnameweb.org/

The Partridge Nest (note new address!!!)
http://www.partridgenest.com/
Webmaster
• Hi Dennis, ... Here is one Larry helped me with that will get you started. The Dos line is one line all the way till ^!Wait. It is set for NoteTab s folders
Message 1 of 20 , Nov 7, 1999
View Source
Hi Dennis,

> I need a clip to gather information on all files and paths to
> those files and direcotries within a directory. So I basically
> need it to move through the directory hierarchy gathering and
> storing information on files and directories.

Here is one Larry helped me with that will get you started. The
Dos line is one line all the way till ^!Wait. It is set for
NoteTab's folders (1324 files in mine <g>), but works well for a
whole drive. You will need to make a loop and increment the
output file and drive for your disk. Use an append loop at the
end. That Clip follows. You will want to hard code your paths,
file types, etc. You might just wait on "my" DOS expert, Larry,
who might be able to do it all in the DOS command in one pass or
a perl wiz kid.

^!Dos Dir /s/b ^?{(T=D)Directory path of all file names you want...=^\$GetAppPath\$}^?{File type=_*.*|.*htm*|*.txt|*.gif|*.jpg} >C:\temp\all.txt
^!Wait
^!Open C:\temp\all.txt

- do the copy thingie ---
H=Append Directory...
; 11/06/1999, Jody@...
; http://www.sureword.com/notetab

;long line
^!Set %Path%=^?{(T=D)Directory to search}; %FileName%=^?{(T=O)Append to what file, include extension, (doesn't need to exist)}; %Type%=^?{File type=_*.*|*.*htm*|*.txt};
^!Set %Full%=^\$GetFileFirst("^%Path%";^%Type%)\$

:Loop
^!IfTrue ^\$IsEmpty(^%Full%)\$ CloseFileFind
^!AppendToFile "^%Path%^%FileName%" ^\$GetFileText(^%Full%)\$
^!Set %Full%=^\$GetFileNext\$
^!Goto Loop

:CloseFileFind
^!IfFileExist "^%Path%^%FileName%" Next else End
^!Open "^%Path%^%FileName%"

- end the copy thingie ---

Here is a pice from Larry's Dos.otl he sent me. You can probably
just add the attributes you want to the line above. My machine
does not like ^\$GetDosOutput...)\$ it seems with certain commands
so I don't mess with it too much, but you might try that as well
to get rid of the ugly dos console.

DIR
Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/P] [/W] [/A[[:]attributes]]
[/O[[:]sortorder]] [/S] [/B] [/L] [/V] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.
(Could be enhanced file specification or multiple filespecs.)
/P Pauses after each screenful of information.
/W Uses wide list format.
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date & time (earliest first)
G Group directories first - Prefix to reverse order
A By Last Access Date (earliest first)
/S Displays files in specified directory and all subdirectories.
/B Uses bare format (no heading information or summary).
/L Uses lowercase.
/V Verbose mode.
/4 Displays year with 4 digits (ignored if /V also given).

Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.

Happy Clip'n!
Jody

http://www.sureword.com/notetab

The NoteTab Clip List...
mailto:Ntb-Clips-Subscribe@...
mailto:Ntb-Clips-UnSubscribe@...
• Dennis said ... Here is a solution I use however it requires you to have installed the Windows Script Host on your system. wsh is part of win 98 default
Message 1 of 20 , Nov 7, 1999
View Source
Dennis said
> I need a clip to gather information on all files and paths to those files
> and directories within a directory.

> The part of the script that I will have the most problem with is actually
> moving through the directory structure

Here is a solution I use however it requires you to have installed the
Windows Script Host on your system. wsh is part of win 98 default install ,
the nt4 option pac and I think a default option in the ie5 install.

The following is two clips. The first clip passes the folderpath to the js
script
as an argument. It grabs the output from the clipboard and presents it as a
notetab array presented in the form of input checkbox of all the folders in
a directory.

The 2nd is the jscript file. You do not use the clip directly but use it
from the first clip.
The js script which contains a recursive function can be accredited to
Daniel Theil see;
http://www.winscripter.com/howto/fileio/scandir.html
My modification to his original script are minimal in that I changed the way
the script recieved it's arguments and outputs it's results.

see
http://ps.gen.nz/~emerge/site_settings/site_settings_library.htm#GetFolders

ps; watch out for wrapping on long lines
ps; I use this script to get access to all the folders in a site root hence
the variable
%SiteRootPath%
ps; Works ok in all but very large directories (memory allocation prob)

H=getFolders
^!Set %SiteRootPath%=^?{(T=D)Locate=}
^!Set %jsPath%="^\$GetScriptPath\$getFldrs.js"
^!IfFileExist "^%jsPath%" Skip Else Next
;get the root folder
^!Set
%EscapeSiteRootPath%=^\$StrReplace("\";"\\";"^%SiteRootPath%";False;False)\$
^!SetClipBoard ^\$GetOutput(cscript "^%jsPath%" //NoLogo
"^%EscapeSiteRootPath%")\$
^!SetArray %folders%=^?{(T=A)SELECT Folder==^\$GetClipboard\$}

// Create File System Object
var fso = new ActiveXObject( "Scripting.FileSystemObject" );

// variable to hold folder and file names
var msg = "";
var arg = WScript.Arguments.Item(0);

// call the function scandir - passing it the
// directory where we want to start the scan
scandir( arg );

// Function to scan directory
function scandir( dir )
{
// Get Current Folder
var srcFolder = fso.GetFolder( dir );

msg += "_" + srcFolder.Name + "^=" + srcFolder.Path +"|";

// Get any sub folders to current directory
var esub = new Enumerator( srcFolder.SubFolders );

// Loop through sub folder list and scan
// through a recursive call to this function
for(; !esub.atEnd(); esub.moveNext() )
{
var f = fso.GetFolder( esub.item() );
scandir( f );
}
}
WScript.Echo(msg)
• Hi clippers, I added this to my NoteBlock Library and updated the site. See ^!Continue for what it does, but an example you be to extract a names an eMail
Message 1 of 20 , Nov 14, 1999
View Source
Hi clippers,

I added this to my NoteBlock Library and updated the site. See
^!Continue for what it does, but an example you be to extract a
names an eMail addresses out of a document with lines of them
that also has other information on the line.

<--- Copy below this line --->
H=Extract Fields...
; 11/14/1999, Sojourner@..., jody
^!Continue This Clip is used with lines having delimited fields (a line with data separated by tabs, commas, ";", colons, etc.). It is used to extract the text in two specified fields. The Output may be reversed. Continue?
^!ClearVariables
^!Set %Delimiter%=^?[Enter Delimiter: ^p ^t ";", Tab shown=^p^=^%nl%|_^t^=^%Tab%|";"]
^!SetDelimiter ^%Delimiter%
^!Set %n%=0; %Field1%=^?[Extract what field 1=_1|]; %Field2%=^?[Extract what field 2=|_2]; %Reverse%=^?[Reverse output=Yes|_No^=]; %Display%=^?[(Copies to Clipboard automatically) Display in=_Info Window^=Info|New Doc]

^!IfTrue ^\$IsEmpty(^\$GetField(^\$GetRow\$;1)\$)\$ Oops
^!SetHintInfo Working...
^!SetScreenUpdate Off
^!Set %CurCur%=^\$GetRow\$:^\$GetCol\$

:Loop
^!IfTrue ^%Reverse% Skip_2
^!Set %GrabField%=^\$GetField(^\$GetRow\$;^%Field1%)\$^%Delimiter%^\$GetField(^\$GetRow\$;^%Field2%)\$
^!Goto Skip
^!Set %GrabField%=^\$GetField(^\$GetRow\$;^%Field2%)\$^%Delimiter%^\$GetField(^\$GetRow\$;^%Field1%)\$
^!Append %TotalField%=^%GrabField%^%nl%

^!If ^\$GetRow\$ = ^\$GetLinecount\$ Show
^!Jump +1
^!Goto Loop

:Show
^!SetClipboard ^%TotalField%
^!SetCursor ^%CurCur%
^!IfSame "^%Display%" "Info" Next else Skip_3
^!SetWizardTitle ~^\$StrFill(" ";40)\$Results for fields ^%Field1% and ^%Field2%^\$StrFill(" ";40)\$~
^!Info [L]^%TotalField%
^!Goto End
^!Toolbar Paste New
^!Goto End

:Oops
^!Info [L]Oops! You either started on a blank line, told it to start on a blank line, or you use a delimiter that is not in the first field of the line you started on. Sorry, try again.

<--- Copy above this line, right --->
<--- click over the Clipbook and --->
<--- choose "Add from Clipboard" --->

Nite...

Happy Clip'n!
Jody

http://www.sureword.com/notetab

The NoteTab Clip List...
mailto:Ntb-Clips-Subscribe@...
mailto:Ntb-Clips-UnSubscribe@...
• Hi Could someone explain to me why this doesn t work? I m trying to fill an array with a list of path names which come from a getdosoutput command. I couldn t
Message 1 of 20 , Nov 27, 1999
View Source
Hi

Could someone explain to me why this doesn't work?

I'm trying to fill an array with a list of path names which
come from a getdosoutput command. I couldn't get it to fill directly
from the output so i sent it to a text file and now i'm trying to fill
it line by line.I don't get anything.

How do I fill an array line by line from a file, or directly from dos
output??

I know setting the array to nothing doesn't seem right,but how am i
suppose to assign values to it if it doesn't exist??

thanks
Steve

^!ClearVariables
^!Jump DOC_START

^!SetArray %Paths%=
^!Set %path_index%=1
:loop
^!Set %paths^%path_index%%=^\$GetLine\$
^!Inc %path_index%
^!Prompt Path #^%path_index% - ^%paths^%path_index%%
^!Jump +1
^!If ^\$GetRow\$=^\$GetLineCount\$ SKIP_1
^!Goto loop

^!Prompt ^%paths%
• Hi steve, ... You need to get your list first and then put that into the array. If you want to use the DosOutput, open that file then loop through the lines
Message 1 of 20 , Nov 27, 1999
View Source
Hi steve,

> How do I fill an array line by line from a file, or directly
> from dos output??

You need to get your list first and then put that into the array.
If you want to use the DosOutput, open that file then loop
through the lines adding each path to a variable which you later
use in the array. Perhaps you can see what I mean by looking at
the Clip below from my DirStuff. Where I have ^!SetArray %EditList%=^?{(T=A;H=25)Pick=^%Files%} you would change the
I use ^\$GetFile...\$ to get my list in the first section. You
would replace that with your DosOutput list.

H=Checkbox Multi-Open
; 11/12/1999, Sojourner@..., jody
; Requires NoteTab version 4.6a
; http://www.sureword.com/notetab
; Opens files you check in a checkbox list

:ReStart
^!ClearVariable %Files%

; Gets path, file type, with option to add underscore for checkboxes
^!Set %Folder%=^?{(T=D)Browse: full path, end in backslash=}; %Type%=^?{(H=10)File &Types, wildcards OK: *.txt or *.*htm*;*.txt=All Files^=*.*|Html Only^=*.*htm*|Text Only^=*.txt|_Html & Text^=*.*htm*;*.txt|Outline^=*.otl|Clipbook Library^=*.clb|Ini^=*.ini}; %us%=^?{&Check files automatically in file list to open=_Yes^=_|No^=}

^!SetHintInfo Working...
^!SetScreenUpdate Off

; Gets the first filename in the folder
^!Set %FullPath%=^\$GetFileFirst(^%Folder%;"^%Type%")\$

; Checks to see if files are fund by search criteria
^!IfTrue ^\$IsEmpty("^%FullPath%")\$ Error

; Gets the remaining files and appends them all to %Files%.
; The ^%us% is set in the first line and adds an underscore
; if you choose to have the boxes checked for you.
:Loop1
^!IfTrue ^\$IsEmpty(^%FullPath%)\$ DoArray
^!Append %Files%=^%us%^%FullPath%|
^!Set %FullPath%=^\$GetFileNext\$
^!Goto Loop1

; Uses the files from above and makes a checkbox.
:DoArray

^!CloseFileFind
^!SetArray %EditList%=^?{(T=A;H=25)Pick=^%Files%}
^!Set %Count%=^%EditList0%
^!Set %Index%=0

; Opens the files you checked.
:Loop2
^!SetScreenUpdate Off
^!Inc %Index%
^!If ^%Index% > ^%Count% End
^!Open ^%EditList^%Index%%
^!Goto Loop2

:Error
^!Skip There were no files by the file type you search for (^%Type%) in ^%Folder%. Try again?
^!Goto End
^!Goto ReStart

Happy Clip'n!
Jody

http://www.sureword.com/notetab

The NoteTab Clip List...
mailto:Ntb-Clips-Subscribe@...
mailto:Ntb-Clips-UnSubscribe@...
• Hi Steve, You got a fairly complete answer from Jody. Here are some comments that may give you a better understanding about arrays: You can t assign data to an
Message 1 of 20 , Nov 27, 1999
View Source
Hi Steve,

You got a fairly complete answer from Jody.

Here are some comments that may give you a better

You can't assign data to an array element that
doesn't exist.

^!SetArray %paths%=

only creates an array with zero elements.

After which

^!Set %paths1%=something

will simply fail to assign anything.

Instead, you could have assigned an array with as
many empty cells as you needed (tough if you don't
know how many you will need).

i.e. ^!SetArray %paths%=;;;;;;;...;

Or ..
What Jody did was to collect your data in a temporary
variable, using Append, and when all was collected,
assign that data to the array. The conversion to array
works as long as the temporary variable contains array
delimiters between what will be the array elements.
If you forget the delimiter, the array will be just ONE
element.

I've tried assigning to arrays directly with Append, but
this seemed to be somewhat unpredictable.

Below is your own clip, modified as discussed:

;. . .
^!Jump DOC_START
^!Set %path_index%=1
:loop
^!Append %temp%=^\$GetLine\$;
;note the array delimiter ";" after the assignment
^!Inc %path_index%
^!Jump +1
^!If ^\$GetRow\$=^\$GetLineCount\$ SKIP_1
^!Goto loop

^!SetArray %paths%=^%temp%
^!Dec %paths0%
;gets rid of the last, empty cell.

^!Prompt ^%paths%

Cheers,

Eb
Ben Franklin's "Penny saved.. penny earned"
in 1776, at 12% interest / year since then
is now worth more than \$3,000,000,000 !!!
• ______________________________________________________ Bo�te aux = lettres - Caramail - http://www.caramail.com
Message 1 of 20 , Dec 9 9:14 PM
View Source
______________________________________________________
Boîte aux lettres - Caramail - http://www.caramail.com
• I posted this to the wrong list and got referred here so I guess I will just repost it. I stand corrected. Hallo again, Since every one is so friendly and
Message 1 of 20 , Jan 7, 2000
View Source
I posted this to the wrong list and got referred here so I guess I will
just repost it. I stand corrected.

Hallo again,
Since every one is so friendly and helpfull I will try another question.
I'm rather new at this and have only mastered simple clip programming so far.
I would like a clip to make a separate list of (for instance) links or IMG
tags used in a HTML document. Preferably it would list anything that can be
specified in any document.
Anyone know of such a clip or something similar I can learn from and modifie?
Lotta
• Hi Lotta, ... So, did you need something else? :) Happy Clip n! Jody http://www.sureword.com/notetab The NoteTab Clip List...
Message 1 of 20 , Jan 7, 2000
View Source
Hi Lotta,

> Since every one is so friendly and helpfull I will try another
> question. I'm rather new at this and have only mastered simple
> clip programming so far. I would like a clip to make a separate
> list of (for instance) links or IMG tags used in a HTML
> document.

You wote private eMail:

So, did you need something else? :)

Happy Clip'n!
Jody

http://www.sureword.com/notetab

The NoteTab Clip List...
mailto:Ntb-Clips-Subscribe@...
mailto:Ntb-Clips-UnSubscribe@...
• ... Well, it is nice and does do the job with links. But why settle for half if you can get it all? I m greedy! ;)
Message 1 of 20 , Jan 7, 2000
View Source
>
> > Snached your "ExtractLinks". Very nice and does the job fine!
>
>So, did you need something else? :)
Well, it is nice and does do the job with links. But why settle for half if
you can get it all? I'm greedy! ;)
• Hi, After I sort my text file by line, how do I remove blank spaces at the end of each line?
Message 1 of 20 , Mar 19, 2000
View Source
Hi,
After I sort my text file by line, how do I remove blank spaces at the
end of each line?
• Hi Jody: ... I have changed the 68 to 50, but have not discovered the magic save command. File | Save won t do it. I was in the code pane when I made the
Message 1 of 20 , Mar 27, 2000
View Source
Hi Jody:

ntb-clips@egroups.com:

>> When I hit the start button here, I get a Start
>window with
> > dialogue slots which asks for the character
>limit for lines. It
> > is initially fixed at 68 characters and I have
>not discovered
> > how to change it. If I enter 50 characters, for
>instance, and
> > hit OK, the 50 apparently is immediately
>replaced by 68.
>
>
>Right click over the Start Clip and choose Edit
>Clip... Look for
>the 68 and change it to what you want, save and
>close the Clip
>Editor. If you need to discuss it more, please
>Clips list.
>
>
>

I have changed the 68 to 50, but have not discovered
the magic save command. File | Save won't do it. I
was in the code pane when I made the change.

Paul King
Your message has been successfully submitted and would be delivered to recipients shortly.
• Changes have not been saved
Press OK to abandon changes or Cancel to continue editing
• Your browser is not supported
Kindly note that Groups does not support 7.0 or earlier versions of Internet Explorer. We recommend upgrading to the latest Internet Explorer, Google Chrome, or Firefox. If you are using IE 9 or later, make sure you turn off Compatibility View.