Hi, I was wondering if it's possible to detect where the script was launched from. I need to be able to detect if the script was launched from the console window or from the window environment by using a shortcut or some GUI file manager.
The purpose is: If the program was launched from the console, it will be outputting directly to console. I mean, running with it's text version interface, but if it was launched from the GUI by a file manager or a shortcut, or whatever (NOT console), it will be launched in it's GUI Window (not text) interface with buttons etc.
I can't use ENV variable to test if it's console, because perl says that it's console, unless it's ran as a CGI.
And no, I don't want to pass parameters in the shortcut or the command line, to specify that it's GUI. I just want to be able to type or double-click on the script file.
I know that it's possible, because, a long time ago, a Creative sound card came with a music player with the drivers installation. It could launch a text version of the player in the dos window when you type it's executable from the dos window, but when it was launched from the file manager by double-clicking on the executable, it launched it's GUI version.
So, in other words, when the script detects that it was being typed in the console to launch, it will use console interface subroutine (STDIN/OUT, etc.), but when it detects that it was launched not from the console, it will go to the Tkx subroutine for the GUI interface.