Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chat with Me -- HOST
#11
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. Big Grin Big Grin Big Grin

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.
Reply
#12
Thumbs Up 
Pete, now it finds the address, but 'SHELL _HIDE "ipconfig>tmp.tmp" must not be commented out.

[Image: IP-Adresse-korrekt12-12-2022.jpg]

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
Reply
#13
Yes, you must have tried it before I came back and edited it. I commented it out while testing your results.

Pete
Reply
#14
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".
Reply
#15
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.
Reply
#16
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.
Reply
#17
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
Reply
#18
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
Reply
#19
(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".
Reply
#20
(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.

[Image: IP-Adresse-Notepad2022-12-13.jpg]
Reply




Users browsing this thread: 5 Guest(s)