Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
(12-13-2022, 12:26 AM)SMcNeill Wrote: Try:
$CONSOLE:ONLY
Shell "D:\Program Files\Notepad++\notepad++.exe tmp.three"
SLEEP
You should be able to get an idea of the issue from the output on the console.
Sometimes a .\ helps with pathing, such as .\tmp.three
Thanks! I tried it, but the program is not found there.
Posts: 2,697
Threads: 327
Joined: Apr 2022
Reputation:
217
Sounds like SHELL _HIDE _DONTWAIT might be what you want.
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
12-13-2022, 03:49 PM
(This post was last modified: 12-13-2022, 03:49 PM by Kernelpanic.)
Quote:@mnrvovrfc - There should have been no need for "start" and "SHELL" should have been sufficient.
The "start" is intended to ensure that when an external program is called, the program from which the call originates is not exited. At least that's what the manual for QuickC says.
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
12-13-2022, 03:53 PM
(12-13-2022, 03:44 PM)SMcNeill Wrote: Sounds like SHELL _HIDE _DONTWAIT might be what you want.
Thanks, that's it! - The wiki should really be published as a book.
Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
(12-13-2022, 03:40 PM)Kernelpanic Wrote: (12-13-2022, 12:57 AM)Pete Wrote: Code: (Select All) IF _FILEEXISTS("D:\Program Files\Notepad++\notepad++.exe") THEN
SHELL "D:\" + CHR$(34) + "Program Files" + CHR$(34) + "\Notepad++\notepad++.exe tmp.three"
ELSE
PRINT "Cannot find notepad++"
END IF
Thank's for the Tipps! It even works with "Program Files" now, thanks Pete. The IP number is displayed and Notepad opens with the specified file. There are two peculiarities:
1. The command line is also opened; is probably due to "Shell".
2. Without "_DontWait" the output window can/will not be closed until Notepad is closed.
It shows, however, that it is also possible with Basic, even with "Program Files". Upgradable! I will try if I can pack the call to external programs in a function.
Glad you got it working. SHELL is a bit fickle. As Steve pointed out, we have _HIDE and _DONTWAIT additions, whoich are pretty self-explanatory.
_DONTWAIT is always needed with apps like Notepad. Without it, as you discovered, the program flow will not continue until the SHELL is closed, which means closing Notepad, Notepad++, etc.
Now excluding _DONTWAIT is necessary if you need to suspend your program until action is taken in the app it opened.
_HIDE prevents the cmd.exe console from appearing on the screen. Now here is where I call "fickle" on SHELL...
I have had situations where adding _HIDE causes the SHELL to not function. I have had some other instances where I had to add "START" to make the SHELL function, too. So keep those in mind for future reference and fiddle with some different combinations and you might get your future SHELL statements to work if they initially fail. Oh, and if you are shelling to your own apps, try to avoid directories you make for them with spaces. Use dashes, instead. That cuts down on the work adding CHR$(34)'s in your SHELL calls.
Pete
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
12-13-2022, 05:06 PM
(This post was last modified: 12-13-2022, 05:09 PM by mnrvovrfc.)
(12-13-2022, 03:43 PM)Kernelpanic Wrote: Thanks! I tried it, but the program is not found there.
This screenshot reveals all: the space is the culprit. It's what I've been trying to say but you guys were unaffected it seems. That's why I proposed the "PROGRA~1" or the other "outdated, internal 8-dot-3" name before the attempt was made instead from "D:\Programme".
On Linux might have been able to do something like this:
Code: (Select All) D:\'Program Files'\Notepad++\Notepad++.exe
Incredibly, the stuff that prepares Wine and its related shortcuts doesn't do things this way, it creates a "dot-desktop" file that sometimes fails to launch the Windows app. So I have to get on top of it creating the "dot-desktop" file myself.
(12-13-2022, 03:40 PM)Kernelpanic Wrote: Thank's for the Tipps! It even works with "Program Files" now, thanks Pete. The IP number is displayed and Notepad opens with the specified file. There are two peculiarities:
1. The command line is also opened; is probably due to "Shell".
2. Without "_DontWait" the output window can/will not be closed until Notepad is closed.
It shows, however, that it is also possible with Basic, even with "Program Files". Upgradable! I will try if I can pack the call to external programs in a function.
Wait, did it work after all as D:\"Program Files"\... ?!
(facepalm) Now I'm that long-eared critter that Sam wants to shoot down, do it now while I'm blindfolded...
Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
12-13-2022, 05:38 PM
(This post was last modified: 12-13-2022, 05:41 PM by Pete.)
It's fickle. Sometimes I get away with just enclosed quotes for the directory the space occurs in, sometimes I have to enclose the whole path in quotes.
Just now...
SHELL _HIDE _DONTWAIT "notepad " + cmd$ ' Didn't work for the app I am building, but SHELL _DONTWAIT "notepad " + cmd$ worked just fine!
Sam's advice: Just keeps eh shootin' 'til ya's hits sometin, varmint!
Pete
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
(12-13-2022, 05:38 PM)Pete Wrote: SHELL _HIDE _DONTWAIT "notepad " + cmd$ ' Didn't work for the app I am building, but SHELL _DONTWAIT "notepad " + cmd$ worked just fine!
But the following doesn't work?
SHELL _HIDE _DONTWAIT "start notepad " + cmd$
It's because "HIDE" attribute is being involved, while in the other one that worked it has to display a "dummy" console window which is the launch pad. This was already indicated by Kernelpanic.
To fire up an app such as Windows Notepad, "HIDE" should imply "DONTWAIT". I mean, the user would be fed up if the user program "suddenly" halts because he/she needs to quit some other program but he/she doesn't know it yet. How about using "_SHELLHIDE()" instead and checking out the value it returns?
Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
The one you posted with START does work for me...
Example:
Code: (Select All) SHELL _HIDE _DONTWAIT "notepad" ' Doesn't launch.
BEEP: SLEEP
SHELL _HIDE _DONTWAIT "start notepad" ' Launches because of START.
BEEP: SLEEP
_HIDE causes the first one not to launch, but adding "start" in the second example allows it to launch Notepad.
I'd like to buy the explanation that _HIDE prevents the cmd.exe console form launching an app, but I don't believe that is so, because...
Code: (Select All) SHELL _HIDE _DONTWAIT "firefox"
See? _HIDE with No "start" and Firefox launches where Notepad wouldn't.
Fickle.
Pete
Posts: 734
Threads: 30
Joined: Apr 2022
Reputation:
43
What are we trying to do here, gentlemen? I'm confused.
Tread on those who tread on you
|