Set_View ini and disk BufferS

Reposted 2/2/06
Here are revised, REVISED, clips, one to use NoteTabs users inifile feature to store tidbits of information, the other, to use disk files as a temporary storage medium.

For setting new buffers the clip uses the first word in the selection, if it is descriptive enough you can accept that name or type over with your own name choice.

Both approaches appear to work well, the disk file method doesn’t have the text selection size limitations of the ini file storage method.

Both approaches store a variable in memory at buffer creation. If you perform an action that wipes the variable, change or close the clipbook, close NoteTab, shut down the computer, you can regenerate the memory variable.

Go into the View_Set mode, select the buffers for which you want to regenerate memory variables, as you step thru each buffer view the variable is reset.

BOTH CLIPS ARE ON THIS PAGE.

<>····················<>
Set_View ini BufferS

Select between Markers, Add to ClipBook.

<>------------Marker------------<>
H="Set_View ini BufferS"
;_ Modified-Updated~Created_20060202
;_ hrs ø hsavage·pobox·com_11:05:59a
^!ClearVariables
^!Set %ww%=^$IsWordWrap$
^!SetScreenUpdate 0
^!SetIniFile ^$GetLibraryPath$Buffers
; - if no selection made, opens buffers.ini or exits
^!If ^$GetSelSize$ < 11 OPENFILE ; - seizes first word of selection as buffer name, can be typed over ^!Set %add%=^?{NAME BUFFER ADDITION=^$GetWord$} ^!Set %add%=^$StrReplace(" ";"_";^$StrTrim("^%add%")$;0;0)$ ^!SaveValue ^$StrUpper("^%add%")$=^$GetSelection$ ^!Select 0 ; ·-·-· ; - switch comment from 'p_' line to set "permanent Variable" ^!Set %^$StrLower("^%add%")$%=^$GetValue("^%add%")$ ;^!Set %p_^$StrLower("^%add%")$%=^$GetValue("^%add%")$ ; ·-·-· ^!Goto REAL_END ; ·-·-·-·-· :OPENFILE ^!IfFileExist ^$GetLibraryPath$Buffers.ini NEXT ELSE EXIT ^!Open ^$GetLibraryPath$Buffers.ini /j=1 ^!SetWordWrap 0 ; ·-·-·-·-· :MAKE_LIST ; - loops thru and lists keys ^!Find ^[A-Z0-9_]+= RS ^!IfError SET_ARRAY ^!Set %extract%=^$StrReplace("=";"";"^$GetSelection$|";0;0)$ ^!Append %list%=^%extract% ^!Goto MAKE_LIST ; ·-·-·-·-· :SET_ARRAY ; - shows an array of key names ^!Set %list%=^$StrDeleteRight("^%list%";1)$ ^!SetListDelimiter | ^!SetArray %list%=^?{(H=26;T=A)INI-BUFFER/S TO CHOOSE!==^%list%}; %bfr_action%=^?{VIEW BUFFERS, SET VARS -- DEL BUFFERS, CLEAR VARS==_VIEW_SET|DEL_CLEAR|VIEW_ONLY-ALL_BUFFERS} ; ·-·-· :VIEW_ONLY-ALL_BUFFERS ; - to view buffer only, make no selection ^!If "^%list%" = "" EXIT ELSE ^!Close DISCARD ^!Set %loop%=0; %count%=^%list0% ; ·-·-·-·-· :LOOP ^!Inc %loop% ^!Set %bfr_key%=^$GetValue("^%list^%loop%%")$ ; ·-·-· ; - clears, resets chosen variable ^!ClearVariable %^$StrLower("^%list^%loop%%")$% ^!ClearVariable %p_^$StrLower("^%list^%loop%%")$% ; - switch comment from 'p_' line to set "permanent Variable" ^!Set %^$StrLower("^%list^%loop%%")$%=^%bfr_key% ;^!Set %p_^$StrLower("^%list^%loop%%")$%=^%bfr_key% ; ·-·-· ^!Goto ^%bfr_action% ; ·-·-·-·-· :VIEW_SET ^!Info [L]TIDBIT·····^%list^%loop%%^%nl%^%nl%^%bfr_key% ^!Goto ANOTHER_LOOP? ; ·-·-·-·-· :DEL_CLEAR ; - delete key, clear associated variable, ^!ClearValue ^%list^%loop%% ; ·-·-· ; - switch comment from 'p_' line to clear "permanent Variable" ^!ClearVariable ^%list^%loop%% ;^!ClearVariable %p_^%list^%loop%%% ; ·-·-·-·-· :ANOTHER_LOOP? ^!If ^%loop% < ^%count% LOOP ; ·-·-·-·-· :REAL_END ^!StatusClose ^!SetWordWrap ^%ww% <>------------Marker------------<>

Number of Valid Clip-lines=76

<>··········Separator··········<>

Set_View Disk BufferS

Select between Markers, Add to ClipBook.

<>------------Marker------------<>
H="Set_View Disk BufferS"
;_ Modified-Updated~Created_20060202
;_ hrs ø hsavage·pobox·com_12:04:09a
; ·-·-·
; - Buffer names are restricted to characters
; - available for use in filenames
^!ClearVariables
^!SetScreenUpdate 0
^!Set %ww%=^$IsWordWrap$
; ·-·-·
^!Set %bfr_idx%="^$GetExpandedName(^##)$"
^!Set %bfr_dir%="^$GetDocumentPath$Buffers\"
; ·-·-·
; - adjustable, unless selection is => 11 characters
; - clip diverts to view/clear section
^!If ^$GetSelSize$ < 11 SET_ARRAY ; ·-·-· ^!IfFileExist "^%bfr_dir%nul" SKIP_1 ELSE NEXT ^!MkDir "^%bfr_dir%" ; ·-·-·-·-· :MAKE_BFR ^!Set %bfr_name%=^?{ENTER MAKE_BUFFER NAME=^$GetWord$} ^!Set %bfr_name%=^$StrReplace(" ";"_";^$StrTrim("^%bfr_name%")$;0;0)$ ^!SetCode %bfr_txt%=^$GetSelection$ ^!TextToFile "^%bfr_dir%^$StrUpper(^%bfr_name%)$" ^%bfr_txt% ; ·-·-· ; - switch comment from 'p_' line to set "permanent Variable" ;^!Set %^$StrLower("^%bfr_name%")$%="^%bfr_txt%" ^!Set %p_^$StrLower("^%bfr_name%")$%="^%bfr_txt%" ; ·-·-· ^!Goto REAL_END ; ·-·-·-·-· :SET_ARRAY ^!SetListDelimiter | ^!Set %files%=^$GetFiles("^%bfr_dir%";"*.*";NAME)$ ^!If ^%files%=^%EMPTY% END ^!Set %files%=^$StrReplace("^%bfr_dir%";"^%empty%";"^%files%";0;0)$ ^!SetArray %files%=^?{(H=26;T=A)BUFFER FILE TO CHOOSE!==^%files%}; %bfr_action%=^?{Open-Set vars, View-Set vars, DEL Files, Clear Vars==OPEN_SET|_VIEW_SET|DEL_CLEAR} ; ·-·-· ;_END_IF_NO_CHOICE ^!IfTrue ^$IsEmpty(^%files%)$ NEXT ELSE SKIP_3 ^!StatusShow NO FILE SELECTED ^!Delay 25 ; ·-·-· ^!Goto REAL_END ; ·-·-· ^!Set %loop%=0; %count%=^%files0% ; ·-·-·-·-· :LOOP ^!Inc %loop% ^!Set %bfr_name%=^$GetFileName(^%files^%loop%%)$ ^!SetCode %bfr_txt%=^$GetFileText("^%bfr_dir%^%bfr_name%")$ ; ·-·-· ; - switch comment from 'p_' line to set "permanent Variable" ;^!SetCode %^$StrLower("^%bfr_name%")$=^%bfr_txt% ^!SetCode %p_^$StrLower("^%bfr_name%")$%=^%bfr_txt% ; ·-·-· ^!Goto ^%bfr_action% ; ·-·-·-·-· :OPEN_SET ; - this will open the buffer file as an ordinary file ^!Open ^%bfr_dir%^%bfr_name% ; ·-·-· ^!Goto ANOTHER_LOOP? ; ·-·-·-·-· :VIEW_SET ; - this will display in an ^!Info [L] box, can be selected and pasted ^!Info [L]TIDBIT·····^%bfr_name%^%nl%^%nl%^%bfr_txt% ; ·-·-· ^!Goto ANOTHER_LOOP? ; ·-·-·-·-· :DEL_CLEAR ; - ^!RecycleFile or ^!DeleteFile, to recycle or, delete from disk ^!RecycleFile "^%bfr_dir%^%bfr_name%" ; ·-·-· ; - switch comment from 'p_' line to set "permanent Variable" ;^!ClearVariable %^$StrLower("^%bfr_name%")$% ^!ClearVariable %p_^$StrLower("^%bfr_name%")$% ; ·-·-·-·-· :ANOTHER_LOOP? ^!If ^%loop% < ^%count% LOOP ; ·-·-·-·-· :REAL_END ^!StatusClose ^!SetWordWrap ^%ww% <>------------Marker------------<>

Number of Valid Clip-lines=85

Leave a Reply

Recent Posts

Archives

Topics