Reply
Thread Tools
Posts: 50 | Thanked: 5 times | Joined on May 2009 @ UK
#1
Is there an equivalent to batch files in Linux? I want to be able to create an executable file which starts MicroB and then launches multiple websites from a single desktop widget. Can this be done on the N900?
Thanks.

Last edited by sevep; 2011-02-06 at 18:58.
 
Posts: 85 | Thanked: 383 times | Joined on Jan 2010 @ Hong Kong
#2
You may try to do this in your shell script file, say, myScript...

Code:
/usr/bin/browser --url=http://google.com/ &
/usr/bin/browser --url=http://facebook.com/ &
/usr/bin/browser --url=http://yahoo.com/ &
As you can see, the key to run different instances of programs simultaneously is to put the "&" character at the end.

Now, set your file to be executable...

Code:
chmod +x myScript
and run it this way...

Code:
./myScript
There is a side-effect, though --- the Bookmarks page always displays first. I'm not sure how to get rid of it....
 

The Following User Says Thank You to amandalam For This Useful Post:
Posts: 255 | Thanked: 107 times | Joined on Nov 2010
#3
Originally Posted by amandalam View Post
There is a side-effect, though --- the Bookmarks page always displays first. I'm not sure how to get rid of it....
Code:
dbus-send --system --type=method_call --dest=com.nokia.osso_browser /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"google.com" &
dbus-send --system --type=method_call --dest=com.nokia.osso_browser /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"yahoo.com" &
dbus-send --system --type=method_call --dest=com.nokia.osso_browser /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"facebook.com"
 

The Following 3 Users Say Thank You to Char For This Useful Post:
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#4
Originally Posted by amandalam View Post
There is a side-effect, though --- the Bookmarks page always displays first. I'm not sure how to get rid of it....
As it turns out, Firefox Mobile will (unless you specify otherwise) open new tabs in a running copy of the browser rather than create new instances of the browser. So,

Code:
/usr/bin/fennec http://google.com &
/usr/bin/fennec http://facebook.com &
brings up one browser window with two tabs. Pretty cool.
 

The Following User Says Thank You to Copernicus For This Useful Post:
Posts: 50 | Thanked: 5 times | Joined on May 2009 @ UK
#5
Thanks for that, I've tried both MicroB suggestions and will try out FF later.
I'm not very good at this so could someone run by me again how to make this executable so it will work with a Queen BeeCon shortcut on the desktop.
Also can anyone tell me the command to start the stock RSS reader too please?
Thanks again
 
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#6
Originally Posted by sevep View Post
could someone run by me again how to make this executable so it will work with a Queen BeeCon shortcut on the desktop.
Hmm, I've actually not used Queen BeeCon before (I'm an n900 newbie), but I can tell you how to make an executable shell script.

First, you need a shell script. I played around a bit with Firefox, and discovered that if you don't already have it running, you need to give it a few seconds to start up before you start cramming additional websites down its throat. So, I added a "sleep" command to create a pause between requests to execute fennec:

Code:
/usr/bin/fennec http://www.cnn.com &
sleep 5
/usr/bin/fennec http://www.npr.org &
Save this in a text file, with a name you like, say, "OpenWebPages". You can then run the commands in the file by passing it to a shell, e.g. "sh OpenWebPages". However, you can use the magic #! flag to invoke a shell from within the text file itself; when Unix is presented with an executable text file whose first two characters are #!, it runs the program following those two characters and passes the rest of the lines as input to it. So, my amended shell script would now be:

Code:
#!/usr/bin/sh
/usr/bin/fennec http://www.cnn.com &
sleep 5
/usr/bin/fennec http://www.npr.org &
Then, you need to make the text file executable (I use "chmod +x OpenWebPages"), and you can now run it by just typing "OpenWebPages" at the xterm prompt.

I don't know if that's enough for Queen BeeCon to make use of it. There is also apparently a "Desktop Command Execution Widget" out there that can run arbitrary shell scripts from the desktop, but I haven't tried it. After digging around a bit, I found that you can also just write your own Hildon "desktop" file fairly easily, and thus make anything you want visible as an icon on the desktop. This seemed more appealing to me, so I gave it a try. (I stole my info from this thread: http://talk.maemo.org/showthread.php?t=58613 )

Here's the desktop file I used:

Code:
[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Terminal=true
Name=OpenWebPages
Exec=/home/user/OpenWebPages
Icon=Terminal
X-Osso-Type=application/x-executable
Unfortunately, I don't yet know what most of these entries signify, so I'm not 100% sure this is the best way to write a "desktop" file, but this did work for me. What you need to do is copy this file (named OpenWebPages.desktop, I'm not entirely sure you need to give it the name of your executable followed by .desktop, but the rest of the files follow that convention) into /usr/share/applications/hildon. (You'll need root access to do this.) Then, you should be able to to go to the desktop menu and choose "add shortcut", and your OpenWebPages executable should be visible as one of the icons there.

Hope this helps!
 

The Following User Says Thank You to Copernicus For This Useful Post:
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#7
Originally Posted by sevep View Post
Also can anyone tell me the command to start the stock RSS reader too please?
Ah, yeah, a quick grep through /usr/bin shows that the name of the RSS executable is "osso_rss_feed_reader", so you can call that name to run it from the command line (or a shell script).
 

The Following User Says Thank You to Copernicus For This Useful Post:
pursueky's Avatar
Posts: 191 | Thanked: 46 times | Joined on Jun 2010 @ NanJing China
#8
It is so helpful
 
Reply


 
Forum Jump


All times are GMT. The time now is 11:07.