Required: shell scripting wizard!

Mike Bonner bonnmike at gmail.com
Fri Jan 14 10:57:47 EST 2011


Since i've realized I'm not sure what you mean, i'll cover more bases.

In windows a batch file like the following:
start /D"C:\Program Files (x86)\RunRev\LiveCode 4.5.3" livecode.exe %1
start %1

Will on the first line, launch livecode (first define the directory, then
the executable itself, then the passed parameter)
In this case, livecode will start, and $0 will contain whatever url is
passed.
The 2nd line opens whatever url was passed.  If no parameter was passed,
livecode will still open, so that part is fine as is, but the 2nd line that
starts a browser with the url will need to be checked to make sure it's not
empty, otherwise it will open a new empty shell window.

Again, wasn't exactly sure what you were shooting for, but hope this helps.

On the linux front you can try something like this if you want their default
browser.

#!/bin/bash
x-www-browser $1 || { firefox $1; }

This will check to see if x-www-browser exists and if so it runs whatever is
the default. If not, it tries to run firefox.

And still stuck on Mac since I don't have one anymore.



On Fri, Jan 14, 2011 at 7:30 AM, Mike Bonner <bonnmike at gmail.com> wrote:

> Nvm, its early and I just re-iterated what you aleady know you need to do.
> *goes back to bed*
>
>
> On Fri, Jan 14, 2011 at 7:21 AM, Mike Bonner <bonnmike at gmail.com> wrote:
>
>> From the command line if you do yourApp http://www.google.com
>>
>> $1 will contain the url.  Works the same from a bash script.
>>
>> #!/bin/bash
>> path/to/yourApp $1
>> -- will call your app using parameter 1 as parameter 1 inside the app.
>> -- Access it the same way within the app itself using $1
>>
>> $1 is actually the 2nd parameter, $0 will contain the name of the app (or
>> shell script depending)
>>
>> On Fri, Jan 14, 2011 at 6:54 AM, David Bovill <david at vaudevillecourt.tv>wrote:
>>
>>> Actually maybe it is not so hard :) I want to  create a way to launch
>>> LiveCode using shell, but also to pass to it a url in the first param of
>>> the
>>> shell command. As I don't think you can do this directly anymore using
>>> shell
>>> scritps written in LiveCode - I think I need to write a bash script and
>>> set
>>> an environmental variable which I can then access using $ in Livecode?
>>>
>>> This is what I need to do:
>>>
>>> A shell command used to launch your preferred web browser when given a
>>> URL as an argument.
>>> >
>>> > Defaults to "start" on windows, "open" on Mac, and "firefox" on Unix.
>>> >
>>> > Any thoughts?
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>>
>



More information about the use-livecode mailing list