|
Post by mueh on Oct 4, 2023 0:42:23 GMT -5
Hi George!
After thinking whats the best way of accepting more than one file on SPFLite start i came to the conclusion that SPFLite should accept MRFLIST format at startup . It avoids running into Windows command line length limit of 8192 bytes , alllows start of MEDIT sessions and set of active Tab by lower case the mode f.e (v)filename1?(E)filename2|filename3?(E)filename4|filename5
Suggested solution new startup parameter
-MRFILE mrfilename
ObjENV.inc should check for this parameter open this file and read one record (MRFLIST Format) into InitString
To allow a "Warm Start" i suggest (if UserMRFLIST starts with ?) following code change in SPFLite.bas
t = gSQL.GetString("O", "MRFList", "") ' Get the MRF list IF gENV.InitString = "" AND t <> "" AND ISTRUE gENV.ReOpenLast THEN ' If no Cmd line and an existing MRF list gENV.InitString = t ' Set MRF into the InitString MRFOpen = %True ' Set MRF mode gSQL.UpdateString("O", "MRFList", "") ' Kill list so it is only used once END IF '
t = gSQL.GetString("O", "MRFList", "") ' Get the MRF list IF (gENV.InitString = "" or mid$(gENV.InitString,1,1) = "?") AND t <> "" AND ISTRUE gENV.ReOpenLast THEN ' If no Cmd line Warm Start and an existing MRF list gENV.InitString = t + gENV.InitString ' Set MRF into the InitString + UserMRFLIST MRFOpen = %True ' Set MRF mode gSQL.UpdateString("O", "MRFList", "") ' Kill list so it is only used once ELSE gENV.InitString = ltrim$(gENV.InitString,"?") ' trim off Warm start ? if MRFLIST is null END IF '
|
|
|
Post by mueh on Oct 4, 2023 0:49:44 GMT -5
InitFiles: should do the open of the files as it does on restart . It shouldn't cause problems if no -MRFILE is used . This untested modifications look simple but maybe i'm too optimistic . Could you implement this change ? ( would be of great help for me ) Doing termination with active Tabs to see how MRFLIST looks i got error on restart when multiple MEDIT sessions existed . On restart only one MEDIT session is created with files from all MEDIT sessions. following code accumulates all MEDIT file names from next MEDIT Tabs in each of the MEDIT Tabs entries in MRFLIST . The first MEDIT session has than all MEDIT files included . SPFLite.bas
SUB DoTermination(pCmd AS STRING) ELSEIF IsMEdit THEN ' It's a MEdit session FOR j = TP.MEditCount TO 1 STEP -1 ' Put all the names in a string mnames = TP.MEditListGet(j) + IIF$(ISNULL(mnames), "", "|") + mnames NEXT j ' IF ISNOTNULL(mnames) THEN _ ' mrf = TabType + mnames + IIF$(ISNULL(mrf), "", "?") + mrf' Add the mnames string END IF '
Solution: clear mnames after added to mrf
IF ISNOTNULL(mnames) THEN ' mrf = TabType + mnames + IIF$(ISNULL(mrf), "", "?") + mrf' Add the mnames string mnames = "" ENDIF
Wishing you good recovery after eye surgery .
|
|
|
Post by George on Oct 4, 2023 8:21:10 GMT -5
MUEH: Your 2nd request is done, thanks for locating the 1 line correction.
Going to look now at the 1st request, it seems a reasonable solution.
George
|
|
|
Post by George on Oct 4, 2023 8:34:33 GMT -5
MUEH: Is the MRFILE list to REPLACE any existing MRF list, or is it to be concatenated to the existing MRF list?
Or does the leading ? in the MRFILE string indicate whether to Replace or Append? And shold it be Appended or Prepended?
Also MRFILE should probably be just -OPENLIST (or something), MRF is something internal.
George
|
|
|
Post by Robert on Oct 4, 2023 8:42:39 GMT -5
George, I have been wondering about FLISTs and MEDIT-related things in connection with tasks.
Right now, you can create an FLIST and open the *list*, but suppose I have an FLIST that represents a list of files associated with a task. If so, it is likely that I want to open ALL of the files in the FLIST. I *don't* want to open them using MEDIT, but individually.
Can you think of a way to do this?
R
|
|
|
Post by Robert on Oct 4, 2023 8:44:00 GMT -5
George, I have been wondering about FLISTs and MEDIT-related things in connection with tasks.
Right now, you can create an FLIST and open the *list*, but suppose I have an FLIST that represents a list of files associated with a task. If so, it is likely that I want to open ALL of the files in the FLIST. I *don't* want to open them using MEDIT, but individually.
Can you think of a way to do this?
R ===> P.S.
The standard way that command-line programs allow for long commands is to put @arglist.txt and then define your argument list in a text file. This technique has been used for years. It shouldn't be overly hard to add something like that.
G. Great for Pgms that simply Open files. Entering simply @arglist.txt - hmm - would that be Open them individually?, or open in MEDit?
|
|
|
Post by George on Oct 4, 2023 8:48:09 GMT -5
Robert: When you display an FLIST in FM, just issue an ALL EDIT command.
If you mean somehow to do so outside FM - No, FLISTS as a FM tool.
George
|
|
|
Post by mueh on Oct 4, 2023 8:51:53 GMT -5
Hi George ! My intent was to keep the modification as simple as it could be . The leading ? in -OPENLIST file should just indicate to concatenate MRFLIST+OPENLIST . (no need to add ? in code before concatenation) Just an idea (i'm not shure if i want to use it ) if -OPENLIST file ends with ? the concatenation should be OPENLIST+MRFLIST . Thanks
|
|
|
Post by Robert on Oct 4, 2023 10:16:03 GMT -5
George, sorry about my @arglist.txt comment without a better explanation. Mueh started out by mentioning an 8092 character command-line length limit. The standard way to overcome such limits has always been to use an "arg list" argument on the command line. When you see an argument of the form @filename you read the file named filename and treat its text contents as just more command-line argument characters. The @filename can be anything that could be on a command line, not just about opening files.
This can be very useful for the poor souls that run off a command-prompt window and are typing in commands.
R ===> P. S. wow, forgot about ALL EDIT. Truly turning into a geezer :-((
|
|
|
Post by George on Oct 5, 2023 10:29:51 GMT -5
MUEH: OK, added the -OPENLIST stuff, and it seems to be working OK.
Cmdline: -OPENLIST openlist-filename
The OPENLIST file itself can contain any number of lines. There is NO COMMENT ABILITY. The data on each line is stripped of any leading and trailing blanks, and concatenated into ONE logical line.
Syntax for that single logical line is:
[,] If a leading ",", it requests the list of files be APPENDED to any normal recent files being re-opened. If a trailing ",", the list of files is PREPENDED to the normal recent files being re-opened. If NO leading or trailing "," is present, the OPENLIST files will REPLACE any normal re-open files.
File Entry: The full filename (quotes are not needed) if multiple filenames, separate using a comma. The file will be opened in Edit, If you wish, the name can be prefixed with (V) or (B) to request it be opened in View or Browse. (E) for Edit is also available but is assumed.
To request a MEdit session the filename can itself be a list of files, separated by the "|" character. No (E) is required, MEdit is always considered Edit mode.
Examples: D:\Documents\FileA.txt,D:\Documents\FileB.txt Open 2 files in separate tabs, ignore other file re-opens
D:\Documents\FileA.txt|D:\Documents\FileB.txt Open same 2 files in a single MEdit tab ignore other file re-opens
(B)D:\Documents\FileA.txt,(V)D:\Documents\FileB.txt Open the files, one in Browse, one in View ignore other file re-opens
,D:\Documents\FileA.txt,D:\Documents\FileB.txt Open 2 files AFTER any other file re-opens
D:\Documents\FileA.txt,D:\Documents\FileB.txt, Open 2 files BEFORE any other file re-opens
D:\Documents\FileA.txt Same as tthe previous showing how it COULD , be entered on multiple lines. D:\Documents\FileB.txt ,
|
|
|
Post by Robert on Oct 5, 2023 10:45:15 GMT -5
George, is the -OPENLIST able to be shortened down to -O or something?
The -OPENLIST is not quite as general as the @arglist.txt idea, but when the goal is to get a lot of file names, it's perfect. I like the idea that you can specify one file per line. That makes this "open-file" file easy to create and edit.
R
|
|
|
Post by George on Oct 5, 2023 11:07:33 GMT -5
All cmd line operands are 'minimum unique' so abbreviate as you like. So yes, -O is fine
George
|
|
|
Post by mueh on Oct 6, 2023 3:01:19 GMT -5
Thanks George for 23278 . -OPENLIST works perfect if Instance where you want to open the files is not active . If you want to create f.e then MEDIT session in the Instance you just edited the OPENLIST you have to use f.e following do file to start INSTANCE with OPENLIST and exit the Instance . This drives the Initfiles: logic on re-open instead of SendMessage in FUNCTION InitSeeUnique(WCtr AS LONG) AS LONG If SendMeassage is used the OPENLIST string is of course an Invalid Command . To determine in which INSTANCE macro is running i wish there would be a macro function Get_Instance$ working in FM and edit . Meanwhile i use folowing code if Ucase$(OS_GetCommand(1)) = "-I" or Ucase$(OS_GetCommand(1)) = "-INSTANCE" then Instance$ = Ucase$(OS_GetCommand(2)) if Instance$ = "" then Instance$ = "DEFAULT" Thanks
|
|
|
Post by George on Oct 6, 2023 11:44:33 GMT -5
MUEH: Yes, the handing off of an OPEN to an existing instance never anticipated a multi-file open, it can only handle a single file. It would take a fair re-write in the CALLBACK routine to get that to work. (Basically duplicating everything that InitFiles does)
BTW, an easy way to handle minimum unique tests is:
if Ucase$(OS_GetCommand(1)) = LEFT$("-INSTANCE", LEN(OS_GetCommand(1))) THEN
I'll look at creating Get_Instance$(), that's a trivial change.
George
|
|
|
Post by mueh on Oct 7, 2023 11:45:49 GMT -5
Thanks George . Will use your Get Instance code . When i wanted to convert FLIST to OPENLIST i used FM CUT RAW cmd to later convert it with split '""' p',|' all FM CUT RAW fails after Jo's last FM CUT correction with FM Line msg "C/CC can only be used with a CUT command" No Problem in 23088 lvl . Thanks
|
|