Today I made a simple tool for MacOS X. I heavily use the “open”
command in MacOS X: When I’m working in the Terminal and I want to open
a PDF file in Acrobat Reader, I just have to type “open file.pdf” and
it opens quickly in Acrobat Reader. But when I know the url of a PDF
file on the net, an I type “open http://blabla.org/file.pdf”, it opens
an empty Safari window before opening the PDF file in Acrobat Reader.
That’s because “open” opens all files in a http url with the standard
browser.
That gave me the idea to make a configurable script that can open local
and remote files like the command “open”, but you can specify in a
configuration file which remote files the script has to open with the
default browser. Regularly, you want html files (and php and some
others) to be opened by your browser directly, and all others (pdf, ps,
tar.gz) downloaded by the unclose script and opened by their standard
application. So you don’t get an empty browser window with Safari.
I have included the source code of unclose.rb. All arguments to the
script are opened as files or urls. You can configure unclose.rb in a
file .uncloserc in your home directory. This file can contain e.g.:
download_dir ~/Desktop/Download
no_download html
no_download php
This says all downloaded files will be downloaded in de directory
Desktop/Download in your home directory, and that remote html and php
files will be viewed directly by your browser and not downloaded by
unclose to be viewed locally by your browser.
I’d like to get some comments. I want to extend unclose to be used with
other operating systems if e.g. GNU/Linux or MS Windows have a similar
command as the “open” command. And I will support more protocols, like
ftp and scp. After that, I will package it in RAA.
I’d like to get some comments. I want to extend unclose to be used with
other operating systems if e.g. GNU/Linux or MS Windows have a similar
command as the “open” command. And I will support more protocols, like
ftp and scp. After that, I will package it in RAA.
KDE has “kfmclient exec”, which is very powerful. It’s a shell interface
to everything you can do with the KDE tools–download, ftp, http, pdf,
or open any mime type with the associated app.
I’d like to get some comments. I want to extend unclose to be used with
other operating systems if e.g. GNU/Linux or MS Windows have a similar
command as the “open” command. And I will support more protocols, like
ftp and scp. After that, I will package it in RAA.
KDE has “kfmclient exec”, which is very powerful. It’s a shell interface
to everything you can do with the KDE tools–download, ftp, http, pdf,
or open any mime type with the associated app.
I’d like to get some comments. I want to extend unclose to be used with
other operating systems if e.g. GNU/Linux or MS Windows have a similar
command as the “open” command. And I will support more protocols, like
ftp and scp. After that, I will package it in RAA.
KDE has “kfmclient exec”, which is very powerful. It’s a shell interface
to everything you can do with the KDE tools–download, ftp, http, pdf,
or open any mime type with the associated app.
btw, windows has the dos prompt or run or whatever, just type in and
get what you want
BUT this is a really cool script anyway
Yeap, but you cannot do ‘cmd http://some.or.other/file.pdf’ and have the
thing open up acrobat. Nor can you “execute” files and have the coomand
box call the associated application.
It could be interesting to see if you can have such an app read the
associations correctly for all three window systems (KDE (maybe even
Gnome), MacOS X and Windows). Can’t think it would do much good for CLI
application on Linux though.
V.-
Nor can you “execute” files and have the coomand
box call the associated application.
sure you can,
open cmd.exe and write
yourfile.ext
and you’ll get it opened with the associated app
It could be interesting to see if you can have such an app read the
associations correctly for all three window systems (KDE (maybe even
Gnome), MacOS X and Windows). Can’t think it would do much good for CLI
application on Linux though.
V.-
I suppose rox/gnome/kde/xfce now have a common mime database, so you
can rely on that and write back ends to get the mime->app tuples from
every database (i.e GConf or whatever)
good luck!
Yeap, but you cannot do ‘cmd http://some.or.other/file.pdf’ and have the
thing open up acrobat. Nor can you “execute” files and have the coomand
box call the associated application.
I just ran (from windows 98: command /c start http://my.yahoo.com, from Win XP
Pro: cmd /c start http://my.yahoo.com) and they both opened up a browser and
displayed the right page.
Yeap, but you cannot do ‘cmd http://some.or.other/file.pdf’ and
have the thing open up acrobat. Nor can you “execute” files and
have the coomand box call the associated application.
Adding a text file to Autostart does automatically open that file in
notepad. I no longer use Windows but the ‘command’
should open the file in the application associated to the Portable
Document File type (usually Acrobat or Acrobat Reader).
Gis,
Josef ‘Jupp’ Schugt
···
–
Someone even submitted a fingerprint for Debian Linux running on the
Microsoft Xbox. You have to love that irony :).
– Fyodor on nmap-hackers@insecure.org
Thanks for all responses. I now know the open commands for Windows and
KDE: start and kfmclient exec. Could someone try to set open_command
start or open_command kfmclient in ~/.uncloserc and see if it gives the
expected behaviour?
I’m thinking also about support for opening the files with other
applications than the one bound to the specific type.
Thanks in advance,
Koen Vervloesem
···
–
“There are two reasons for the popularity of pizza among code nerds:
firstly, you can send out for it, so you don’t have to leave your work;
secondly, you can hold a slice in one hand and type in code with
another, so you don’t have to leave your work.” (Tony Tyler, Macuser,
August '98)