Posts: 2,169
Threads: 222
Joined: Apr 2022
Reputation:
103
12-11-2022, 11:19 PM
(This post was last modified: 12-11-2022, 11:37 PM by Pete.)
Aha! Language barrier. Nasa-Cow will probably get back to me with something like, "Pete, not even close!"
Thanks for the post back with tmp.tmp file readout @Kernelpanic +2
I took a nap, saw your post, and once again edited the code. It will work for you now.
Thanks especially for "dashing" out the code, for 2 VERY important reasons...
1) It keeps your personal info private.
2) I am printing and framing Steve's reply, where he thought the dashes might be from Virtual Machine.
Hell, if we get software that messes with command prompt output, we're all screwed.
Pete
Shoot first and shoot people who ask questions, later.
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
12-11-2022, 11:49 PM
(This post was last modified: 12-12-2022, 12:01 AM by Kernelpanic.)
Pete, now it finds the address, but 'SHELL _HIDE "ipconfig>tmp.tmp" must not be commented out.
PS: It just doesn't work with Notepad++, not even with the specification of the complete path. Notepad is not in the system path. Let's see.
Code: (Select All) Case Else
Print "Sorry, can't find IP addy. Opening Notepad so you can find it..."
Shell _DontWait "D:\Program Files\Notepad++\notepad++.exe tmp.three"
Exit Do
Posts: 2,169
Threads: 222
Joined: Apr 2022
Reputation:
103
12-12-2022, 12:34 AM
(This post was last modified: 12-12-2022, 12:36 AM by Pete.)
Yes, you must have tried it before I came back and edited it. I commented it out while testing your results.
Pete
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
12-12-2022, 08:46 AM
(This post was last modified: 12-12-2022, 08:48 AM by mnrvovrfc.)
Using files and directories with spaces in the name, with "SHELL" is a PITA.
Try changing from "Program Files" to "PROGRA~1" inside that path.
Like:
Code: (Select All) Case Else
Print "Sorry, can't find IP addy. Opening Notepad so you can find it..."
Shell _DontWait "D:\PROGRA~1\Notepad++\notepad++.exe tmp.three"
Exit Do
Otherwise why not install NPPP somewhere inside the home user directory? That's what I did, I don't install into M$'s protected garden if at all possible. It could be installed "anywhere".
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
12-13-2022, 12:08 AM
(This post was last modified: 12-13-2022, 12:17 AM by Kernelpanic.)
Quote:Using files and directories with spaces in the name, with "SHELL" is a PITA.
Try changing from "Program Files" to "PROGRA~1" inside that path.
I have now tried everything under Basic, everything I could think of, but it doesn't work. - Under C, on the other hand, I got it to work.
This is how it works with the call of two programs under C. Maybe someone knows how to transfer this to Basic?
Code: (Select All) //Aufruf externe Programme - 13. Dez. 2022
//Wie funktioniert dies in QuickBasic?
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
int main(void)
{
printf("\nAufruf eines externen Programms.\n\n");
//Doppelte Schrägstriche! "Start" nur hier, sonst wird
//QB64 erst nach Schließung von Notepad gestartet.
system("start D:\\Programme\\notepad++.exe D:\\Lab\\QuickBasic64\\Forum\\Aufruf-IT-Adressen\\tmp.three");
printf("\n\nStart von QB64\n");
system("D:\\Programme\\QB64Phoenix3\\QB64pe.exe");
return(0);
}
PS: Oh yes, with "program files" and so on it did not work either under Basic or under C. I copied the Notepad++.exe file to Programme as a test.
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
12-13-2022, 12:24 AM
(This post was last modified: 12-13-2022, 12:28 AM by mnrvovrfc.)
dot-H file (missingsystem.h):
Code: (Select All) #define _DEFAULT_SOURCE
#include <dirent.h>
void missing_system(char *cmdlin)
{
char *cp = cmdlin;
int iret;
if (*cp == 0) return;
iret = system(cmdlin);
/* return iret; */
}
top:
Code: (Select All) declare library "missingsystem"
sub missing_system(cmdlin as string)
end declare
bottom:
Code: (Select All) sub new_shell(comd as string)
dim a as string
a = comd + chr$(0)
missing_system a
end sub
call:
Code: (Select All) '$INCLUDE: 'missingsystem.bi'
new_shell "start D:\Programme\notepad++.exe D:\Lab\QuickBasic64\Forum\Aufruf-IT-Adressen\tmp.three"
new_shell "D:\PROGRA~1\Notepad++\notepad++.exe D:\Lab\QuickBasic64\Forum\Aufruf-IT-Adressen\tmp.three"
'$INCLUDE: 'missingsystem.bm'
I noticed you changed the path of NPPP program. There should have been no need for "start" and "SHELL" should have been sufficient. Otherwise Windows is unpredictable... what is known is that while "SHELL" is processed it always chokes on the "C:\Program" then space right after. One of the things that made people stop putting binary files into "Program Files" if they didn't get them from installers. There is widespread "installerphobia" in the forum that I used to belong to, which main focus was music software.
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
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
Posts: 2,169
Threads: 222
Joined: Apr 2022
Reputation:
103
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
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
(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
You might be able to do that in Linux, but using single-quote. Otherwise the double-quotes should surround the program's entire path. Start before "D" drive and end with "dot-exe".
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
(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.
|