Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thanks JamesNC, that's a good suggestion and it creates the behavior I want. I have rewritten the code as below to use the '1' when using 'start' and to dispatch directly (without the '1') when not using start (i.e. for when I provide the absolute path name of an executable for this routine to run for me.) However, :-(

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 (); }

In reply to Re^2: Need mouse move??? for Tk, Windows, Excel, system, start by ff
in thread Need mouse move??? for Tk, Windows, Excel, system, start by ff

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found