in reply to Re: Need mouse move??? for Tk, Windows, Excel, system, start
in thread Need mouse move??? for Tk, Windows, Excel, system, start
When I go to check for the success of running the process by 'system' and 'start' (as seen below by the value printed in 'prob_foundA'), I no longer get a simple-to-check "0-if-OK, non-zero-if-problem" type of return. For example, if the spreadsheet is already in use and I then try running this program, I get the following response:
prob_foundA: '1608' The process cannot access the file because it is being used by another + process.
A normal/successful run produces:
prob_foundA: '756'
And the number back upon success is not even consistently '756', it might be '1632', '528', '408' such that the '1608' above is also likely unrelated to the failure to run the command via 'system'.
So, my next question becomes "How do I know whether 'system' ran the command successfully if I use this '1' trick?" (Trying 'perldoc -f system' and 'perldoc -f exec' tells me a lot but I can't see it mentioning the '1' behavior)
Modified code:
package gs; sub system_start_file { my ( $file_to_run, $dont_use_start ) = @_; unless ( -f $file_to_run ) { my $warn_msg = "red_915ssf Failed to build a proper path name for\n" . "'$file_to_run'\n"; warn $warn_msg; custTk::open_unique_tk_n_ask_question( $warn_msg, [ 'Ok' ] ); return (); } #warn "path537: '$ENV{PATH}'\n"; #my $prob_found #= $dont_use_start #? system $file_to_run #: system 1, 'start', $file_to_run; my $prob_found; if ( $dont_use_start ) { $prob_found = system $file_to_run; $prob_found = $prob_found == 0 ? 'no' : 'yes'; } else { $prob_found = system 1, 'start', $file_to_run; warn "prob_foundA: '$prob_found'\n"; $prob_found = $prob_found ne 0 ? 'no' : 'yes'; } #if ( $prob_found ) if ( $prob_found eq 'yes' ) { my $warn_msg = "red_915ssfpf '$prob_found' There was a problem in trying +to open\n" . "'$file_to_run'\n"; warn $warn_msg; custTk::open_unique_tk_n_ask_question( $warn_msg, [ 'Ok' ] ); #return (); } return (); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Need mouse move??? for Tk, Windows, Excel, system, start
by JamesNC (Chaplain) on Jan 12, 2006 at 19:44 UTC |