<div>Ooh, that $ENV{PROMPT} thing is almost helpful too, but a quick test reveals that this is not the case in ActiveState (5.10.1).</div>
<div> </div>
<p>#! /bin/perl</p>
<p>print &quot;PROMPT is &#39;$ENV{PROMPT}&#39;\n&quot;;<br>print &quot;Press &lt;enter&gt; to exit\n&quot;;<br>&lt;&gt;;<br></p>
<div>Command-line and double-click invocation both show PROMPT is not set.</div>
<div> </div>
<div>r</div>
<div><br><br> </div>
<div class="gmail_quote">On Fri, Dec 10, 2010 at 12:15 PM, Jarrod Overson <span dir="ltr">&lt;<a href="mailto:jsoverson@gmail.com">jsoverson@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">A quick test on a windows machine with strawberry perl shows that the &#39;PROMPT&#39; environment variable gets set when run by the command line but doesn&#39;t when double clicking (with windows set to open a pl file via the perl.exe directly)<br>

<br>
<div>I&#39;m not sure how reliable that is across different system configurations, but might be a lead worth following.</div>
<div><br></div>
<div><br></div>
<div>
<div class="gmail_quote">
<div class="im">2010/12/10 Reuben Settergren <span dir="ltr">&lt;<a href="mailto:ruberad@gmail.com" target="_blank">ruberad@gmail.com</a>&gt;</span><br></div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>Hi Mongers,</div>
<div>
<div></div>
<div class="h5">
<div> </div>
<div>I&#39;m writing some simple scripts for some very command-line-phobic users; or let&#39;s just say they would prefer a mousy solution over a typey solution.</div>
<div> </div>
<div>I&#39;ve already made the script do useful things with no arguments, so they can keep the script on their desktop, paste it into any directory and double-click it, and then the script will discover input files in that directory with glob() and do its thing.</div>


<div> </div>
<div>I&#39;ve also come up with some clever (but probably not original) techniques like checking the special variable $0 (that&#39;s a zero) for _test or _verbose, so I can tell if they changed the filename, and then I can behave as if they had run from the command line with the equivalent switches, and hold up the cmd window at the end with &quot;Press &lt;enter&gt; to close this window&quot;.</div>


<div> </div>
<div>But I&#39;m looking for ways to make it even more idiot-proof.</div>
<div> </div>
<div>Does anybody know of a way that I can tell whether my script was invoked from the command-line or by double-clicking? (other than checking $0 and trusting that the user will never double-click the script meant for command-line invocation?)</div>


<div> </div>
<div>Is there any way to package up a perl script (or .bat?) such that input file(s) can be selected with the mouse, and dragged into the icon for the script, so that the script would then run with the (full?) paths to the selected files as its command-line arguments? (This is a mac paradigm, right? I&#39;ve never seen this on windoze or unix)</div>


<div> </div>
<div>Also open to other clever ideas you may have to offer...</div>
<div> </div>
<div>thx,</div>
<div> </div><font color="#888888">
<div>r</div></font><br></div></div>_______________________________________________<br>San-Diego-pm mailing list<br><a href="mailto:San-Diego-pm@pm.org" target="_blank">San-Diego-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/san-diego-pm" target="_blank">http://mail.pm.org/mailman/listinfo/san-diego-pm</a><br>

</blockquote></div><br></div></blockquote></div><br>