Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a webpage without a console window?

Status
Not open for further replies.

Kirsle

Programmer
Joined
Jan 21, 2006
Messages
1,179
Location
US
I want to know if there's a more efficient way to easily open a webpage in the user's default browser, but without there being a command prompt window.

Basically, this is the way I'm using to open a webpage:
Code:
system ("start [URL unfurl="true"]http://www.website.com/");[/URL]

That will open the user's default browser (be it IE, Firefox, or something else) and link to that URL.

But, when the Perl script is run in an environment that doesn't have a console, this command seems to open a console window for a few seconds or minutes until the command is completed (i.e. when the browser opens and finishes loading the target page, then the console goes away).

If I use `` instead of system(), would that fix it? I'm thinking the "start" command itself seems to open a command prompt window (or use the current one if one exists).

Any help would be appreciated. :-) Thanks in advance.

-------------
Cuvou.com | The NEW Kirsle.net
 
I don't get a konsole when I try that as a CGI or at the command prompt, but I'm trying on my old W98/Apache server.

#!perl
system('start
it just opens IE and loads tek-tips.com into the browser.


------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Here's a test case I did:

test.pl
Code:
system ("start [URL unfurl="true"]http://www.tek-tips.com/");[/URL]

wperl.exe.lnk
Code:
Target: C:\usr\bin\wperl.exe test.pl
Start In: "C:\Documents and Settings\Casey\My Documents"

So the shortcut basically runs test.pl in wperl (no console). Double-clicking the shortcut to run it, causes an empty console to pop up for a few seconds while the system command finishes.

This also happens using ActiveState PerlApp if you mark it to not show a console window.

I also tried:
Code:
`start [URL unfurl="true"]http://www.tek-tips.com/`;[/URL]

And got the same thing.

-------------
Cuvou.com | The NEW Kirsle.net
 
Maybe try
Win32::Process::Create ??

See if that helps you
 
OK, I can see a shortcut opening a dos/perl box before the browser is opened. Because basically perl has to start first. There might be a way to prevent the dos box from opening but I don't know how to do that myself. Maybe you can make sure it opens minimized if nothing else works.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
wperl.exe is a version of Perl that runs without having a console window. I use shortcuts to open my SMTP server in wperl, for example, so I don't have to constantly have a console window open.

The system command executed from within the Perl script, itself, needs a console window. When Perl is run normally and has its own console, you don't notice this because the system command uses the same console window that the Perl script is using. But when the Perl script doesn't have one, system commands need to open a console in order to run. I've seen this behavior with ipconfig too.

-------------
Cuvou.com | The NEW Kirsle.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top