|
Post by Robert on Jan 23, 2023 14:47:59 GMT -5
The change log for 23.019 shows,
"Add a new FM Line Command - EXEC / EX. This command requires a single operand, the name of a normal system command, BAT file or program. SPFLite will invoke the command and add the fully quoted filename from the selected FM line. e.g. EX NOTEPAD would open the selected file in the NOTEPAD editor."
This does not appear to work.
I am sure you can resolve this.
|
|
|
Post by Robert on Jan 24, 2023 9:51:38 GMT -5
I am not sure if my suggestions are in demand, but it seems to me that there is an easier way to accomplish this. There is nothing to prevent a Windows command from being typed in the line command area. If you wanted to apply a command to a file in the FM, I see two ways of doing this:
1. Allow the windows command to be typed directly. So, if I wanted NOTEPAD.EXE to be run, that's exactly what you would type in the line command. It would be necessary to look for the extensions that are considered "commands". A complete list of these can be found from the ASSOC windows command. But, it's a long list.
2. Adopt a convention that a command ending in some special character means to run an external command with that name. Suppose that character were the = sign. Then, if I wanted to run NOTEPAD, I would type NOTEPAD= in the line command. (Using =NOTEPAD would also work.) Right now, if I do this, I just get "invalid command" from SPFLite. This has the advantage that you don't need to say EXE, BAT or anything else, you would internally just run the command and let Windows figure out what the application is, somewhat similar to how the SPFLite command RUN works.
|
|
|
Post by Robert on Jan 24, 2023 11:01:10 GMT -5
I believe the EX/EXEC function could be implemented as a macro, except that most FM functions that are needed require an "FNum" argument to specify the line number within the FM display, but I cannot find a function to get an FNum when an FM line-command macro is executed. All the FM macro examples show a loop from 1 to FMGet_Count.
|
|
|
Post by George on Jan 24, 2023 11:21:33 GMT -5
Robert:
Not clear why EX isn't working for you. I type EX NOTEPAD as a line command for a TXT file, and it opens properly. Or I can enter EX NP (where NP is a simple BAT that invokes NOTEPAD) - works fine.
What are you seeing?
Also, one reason for not going the ASSOC route is that it then precludes accessing scripts. BAT etc.
From Help - Macros - Accessing Macro Operands
FM Line Command Macro differences
When a macro is issued on a File Manager line command, SPFLite will insert a numeric operand immediately after the macro name to indicate which line of the FM list he macro was entered on. e.g. If MYMACRO AA BBB CCC was entered on line 15 of the display, the macro would be invoked as MYMACRO 15 AA BBB CCC. That is, the line number is always the first operand, all others are shifted right.
George
|
|
|
Post by Robert on Jan 24, 2023 16:22:41 GMT -5
I am sorry my explanation was lacking, but that's really all I can tell you. I tried EX NOTEPAD and put an S on a line of a text file in FM, and pressed Enter. Nothing happened. Utterly nothing. It acted like I didn't do anything. Sorry. That's it.
When I tried EX alone, it issues a complaint about EXCLUDE needs 1 parameter. You created a name class clash with EXEC because both it and EXCLUDE have EX as abbreviations.
As for why it failed? No idea. There is nothing more I can say, except that when I made my macro and tried to run Notepad++ it didn't work, but at least I got an SPF_exec error. That was because the directory for NotePad++ was not in the Windows PATH.
|
|
|
Post by Stefan on Jan 24, 2023 17:58:44 GMT -5
Version 23018 beta:
Never needed this but tried it anyway and agree with Robert.
EX Notepad on the FM primary command line gives message " No entries excluded" EXEC Notepad on the FM primary command gives message " Unknown command: EXEC"
|
|
|
Post by George on Jan 25, 2023 9:54:39 GMT -5
OK, I've goofed in forgetting that EXCLUDE is also an FM Primary. I've never used it once since it went in, I'm not surprised I forgot about it.
The announcement did say EX is an FM LINE command, obviously not prominent enough..
So I can either rename it (suggestions welcome), or just drop it and make Roberts =.MACRO part of the distribution.
I've no problem making stuff like this a macro, but that means no visibility for the command anywhere and I believe it would just languish in the sample macros folder.
This is a basic problem with sample macros for which I have no good solution.
George
|
|
|
Post by Robert on Jan 25, 2023 10:14:36 GMT -5
I believe the problem stems from this line in the Change Log:
"SPFLite will invoke the command and add the fully quoted filename from the selected FM line."
The only way I know to SELECT a line in FM is to put an S on it. That leaves EXEC as a primary command.
The word "Line" that precedes all this got glossed over in the shuffle.
Sorry for the confusion.
|
|
|
Post by George on Jan 25, 2023 10:41:08 GMT -5
Robert: Hmmm, then that means every other FM Line command does NOT select the line it's entered on? Or a left-click does NOT select the line?
OK, it maybe should have been worded better, but it's a Change Log after all, not the main Help file.
What about the name? Keep it at all? Replace with =.MACRO?
George
|
|
|
Post by Robert on Jan 25, 2023 12:23:42 GMT -5
If I were doing it, I would make a minor change to the line command parser, so that if the first character in it were = you would first pad it with a blank, so that the = would be treated like a 1-char name.
That way, you could say =NOTEPAD instead of = NOTEPAD
But, that's just me. It would definitely be a 'hack' and could have possible side effects. And, it's not totally necessary. As for EX/EXEC, that is something I would never use, given that I can now say =
|
|
|
Post by Robert on Jan 26, 2023 12:45:34 GMT -5
It turns out that, in all likelihood, the only command I would ever run like this is Notepad++
Since I know that, I made a clone of =.MACRO called NP.MACRO that only runs this program. So now, I don't need an = sign at all to run this, just NP
So, there is no need to do the 'hack' described above; not for me, anyway.
|
|
|
Post by George on Jan 26, 2023 12:49:58 GMT -5
I think I will just pick a new name for EX so it doesn't collide with the primary and leave it as-is.
Any thoughts on a replacement?
George
|
|
|
Post by Robert on Jan 26, 2023 13:33:20 GMT -5
Yes, use / as the "name". "/" can never be part of any program name, and is not currently being used for any purpose. Even in Edit, "/" is an option on a line command, but not a command itself. So, "/" does not clash with any existing usage.
If you did this, you would not have to "hack" the FM line command processor. And, it would be easy to type and would not require a space after it to work.
So, Notepad would run by putting /NOTEPAD on the line command. Easy-peasy.
Then, I can get rid of my =.MACRO
===> P.S.
For uses with non-QWERTY keyboards that have a difficult-to-type / key, you could let a , comma work as an alternative / command.
A lone-dot now acts like S in FM, and ".name" is a request to use overriding profile "name", so you can't use dot.
But, a comma is now treated as an illegal command, and so is available.
So, for non-QWERTY users, they would issue:
,NOTEPAD
to get the same thing done as /NOTEPAD
|
|
|
Post by George on Jan 26, 2023 15:32:11 GMT -5
Robert: Maybe I'm naive, you know a world more than me about keyboards, but are there really keyboards where /, (One of the normal math characters) is difficult to type? If so, then forget special characters, we'll just have to find a short character based name.
George
|
|
|
Post by Robert on Jan 26, 2023 15:55:42 GMT -5
Yes, the keyboard where / is hard is German, that's why Stefan asked for the / \ options to be typed as . and .. instead. Maybe you forget.
In any case, you already have short name: W
Right now, if you type W on a line having MYFILE.TXT the W command uses the windows Shell to open the file. The Shell figures out that .TXT file are opened with NOTEPAD by default, so that's what it does.
If you want a 'normal' FM command format, then I suggest allowing W to accept a command parameter, and then use it to operate like your EXEC/EX does. An advantage for that is that it doesn't introduce (or, use up) any new letters or names; it just enhances the W command you already have.
You can probably merge the existing W and EXEC line-command source code to make a single, more powerful command.
If you don't like the leading / for EXEC (but it's so nice ...) then an enhanced W would be my vote.
|
|