in reply to Prevent windows dialog when using file test -e
You can control the display of error dialogs through the API SetErrorMode(). Using Win32::API::Prototype it looks like this. See the link for possible values of the argument and note that they are bit flags that can be or'd together.
#! perl -slw use strict; use Win32::API::Prototype; ApiLink( 'Kernel32', q[ UINT SetErrorMode( UINT uMode ) ] ); SetErrorMode( 0x8000 ); ## Updated per ikegami's correction below. if( -e $ARGV[ 0 ] ) { print 'Found it?' } else { print 'Not found'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Prevent windows dialog when using file test -e
by Outaspace (Scribe) on Jun 22, 2006 at 11:47 UTC | |
by ikegami (Patriarch) on Jun 22, 2006 at 17:19 UTC | |
by BrowserUk (Patriarch) on Jun 22, 2006 at 21:04 UTC | |
by Outaspace (Scribe) on Jun 22, 2006 at 21:56 UTC | |
by ikegami (Patriarch) on Jun 22, 2006 at 22:10 UTC | |
by Outaspace (Scribe) on Jun 23, 2006 at 11:41 UTC |