[Express] Using Applescript to open a downloaded file?

I’d like to download a file, strip off an erroneous “.txt” extension that gets put on it (this is in Mac OS X) and then finally open it. Is there a simple way to do this via Applescript included in an action. Maybe there’s a script already there to open a downloaded file, but I haven’t been able to find it in the ActionsForge section.

Thanks for any help.

Chris Young
email@hidden

website: http://home.comcast.net/~cy56/ws1/


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sometime around 2/2/10 (at 06:31 -0500) Christopher Young said:

I’d like to download a file, strip off an erroneous “.txt” extension
that gets put on it (this is in Mac OS X) and then finally open it.
Is there a simple way to do this via Applescript included in an
action.

Ooh, security alert! :slight_smile:

If you mean can you make a web page that offers a download and also
attempts to manipulate and open that downloaded file on the visitor’s
computer… hell no!
(1) You can’t.
(2) If you could, that would be such an open door for hackers. Which
is the reason for (1).

If you want to do something on your own machine because you’re fed up
with downloads arriving incorrectly named, Automator is probably your
best bet. This makes it fairly easy to achieve this kind of thing.
You could make it act as a droplet app so you can drag-and-drop files
onto it.

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Chris,
What exactly are you trying to do. You could create an Applescript
that uses curl to download a file and save and rename it locally on
your machine. You could even do this on your web server with PHP and
then force the file to download to the user’s machine. Once there,
however, your script won’t have any further control over the file.
Regards,
Tim.

On 2 Feb 2010, at 11:31, Christopher Young wrote:

I’d like to download a file, strip off an erroneous “.txt” extension
that gets put on it (this is in Mac OS X) and then finally open it.
Is there a simple way to do this via Applescript included in an
action. Maybe there’s a script already there to open a downloaded
file, but I haven’t been able to find it in the ActionsForge section.

Thanks for any help.

Chris Young
email@hidden

website: http://home.comcast.net/~cy56/ws1/

FreewayActions.com - Freeware and commercial actions for Freeway
Express & Pro.

Protect your mailto links from being harvested by spambots with Anti
Spam.
Only available at FreewayActions.com

http://www.freewayactions.com


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Feb 2, 2010, at 7:37 AM, Tim Plumb wrote:

Hi Chris,
What exactly are you trying to do. You could create an Applescript that uses curl to download a file and save and rename it locally on your machine. You could even do this on your web server with PHP and then force the file to download to the user’s machine. Once there, however, your script won’t have any further control over the file.
Regards,
Tim.

I’d just like to make it easier for user’s to click on a picture of a Graphing Calculator file and have it download and open automatically for them, maybe after a courtesy warning.

I think this used to happen with Internet Explorer. You could set a “MIME” type, or something like that, and say what you wanted done with a given file after it was downloaded.

Maybe this was before the massive proliferation of computer viruses.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Chris,
Here’s a nice tutorial about how you can use PHP to force the browser
to download files it would normally display inline - like images;

It’s then up to the user to either save the file to disk or open it in
the default helper application for the file type.
Regards,
Tim.

On 2 Feb 2010, at 13:15, Christopher Young wrote:

I’d just like to make it easier for user’s to click on a picture of
a Graphing Calculator file and have it download and open
automatically for them, maybe after a courtesy warning.

I think this used to happen with Internet Explorer. You could set a
“MIME” type, or something like that, and say what you wanted done
with a given file after it was downloaded.

Maybe this was before the massive proliferation of computer viruses.

FreewayActions.com - Freeware and commercial actions for Freeway
Express & Pro.

Protect your mailto links from being harvested by spambots with Anti
Spam.
Only available at FreewayActions.com

http://www.freewayactions.com


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Feb 2, 2010, at 8:57 AM, Tim Plumb wrote:

Hi Chris,
Here’s a nice tutorial about how you can use PHP to force the browser to download files it would normally display inline - like images;
No Credit Check Loans - Boutell.co.uk
It’s then up to the user to either save the file to disk or open it in the default helper application for the file type.
Regards,
Tim.

On 2 Feb 2010, at 13:15, Christopher Young wrote:

I’d just like to make it easier for user’s to click on a picture of a Graphing Calculator file and have it download and open automatically for them, maybe after a courtesy warning.

I think this used to happen with Internet Explorer. You could set a “MIME” type, or something like that, and say what you wanted done with a given file after it was downloaded.

Maybe this was before the massive proliferation of computer viruses.

Thanks, but just to make it clear, I meant to say that I’d like the Graphing Calculator file corresponding to the picture to get downloaded, not just the picture.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What file-type extension do these GC files have? You could probably
set a mime-type on your server and have this all happen quite
automagically IF there’s a known mime-type for that file extension.
The developer of GC will have registered that file-type with the Mac
at installation time, and GC will respond like any good “helper”
application by opening the file and coming to the front, as long as
the owner of the Mac has left the default settings alone. If they’re
security conscious, and turned off the “Open ‘safe’ files” option in
Safari, then the file will just sit there in the Downloads tray, but
at least then a double-click will launch the correct application to
open it.

Walter

On Feb 2, 2010, at 4:38 PM, Christopher Young wrote:

On Feb 2, 2010, at 8:57 AM, Tim Plumb wrote:

Hi Chris,
Here’s a nice tutorial about how you can use PHP to force the
browser to download files it would normally display inline - like
images;
No Credit Check Loans - Boutell.co.uk
It’s then up to the user to either save the file to disk or open it
in the default helper application for the file type.
Regards,
Tim.

On 2 Feb 2010, at 13:15, Christopher Young wrote:

I’d just like to make it easier for user’s to click on a picture
of a Graphing Calculator file and have it download and open
automatically for them, maybe after a courtesy warning.

I think this used to happen with Internet Explorer. You could set
a “MIME” type, or something like that, and say what you wanted
done with a given file after it was downloaded.

Maybe this was before the massive proliferation of computer viruses.

Thanks, but just to make it clear, I meant to say that I’d like the
Graphing Calculator file corresponding to the picture to get
downloaded, not just the picture.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sometime around 2/2/10 (at 16:55 -0500) Walter Lee Davis said:

the Downloads tray

Been spending time in Windows, eh Walter? :wink:

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The Beloved bought a new Windows 7 Dell laptop for her office and I
had to set it up for her. And then wash my eyeballs with bleach.

Walter

On Feb 2, 2010, at 6:46 PM, Keith Martin wrote:

Sometime around 2/2/10 (at 16:55 -0500) Walter Lee Davis said:

the Downloads tray

Been spending time in Windows, eh Walter? :wink:

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You and me, both! I’ve just replaced an old space consuming PC, only
used for web testing by me, but needed by the “better (?) half”, with
a shiny Medion laptop. It’s a bit like setting up Windows 95 through
frosted glass. OK, Windows 7 found the network first time: then it
lost one of the computers on it: which reappeared on one account, but
not the main admin one: and vice versa, etc., etc.

I sympathise.

The only bright spot, the laptop cost me less than £20 (£30), because
I had a load of points to use up from a loyalty card. Sometimes pays
to have an extended (and hungry) family spread from top to toe of the
UK.

Colin

On 3 Feb 2010, at 01:58, Walter Lee Davis wrote:

The Beloved bought a new Windows 7 Dell laptop for her office and I
had to set it up for her. And then wash my eyeballs with bleach.

Walter

On Feb 2, 2010, at 6:46 PM, Keith Martin wrote:

Sometime around 2/2/10 (at 16:55 -0500) Walter Lee Davis said:

the Downloads tray

Been spending time in Windows, eh Walter? :wink:

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Feb 2, 2010, at 4:55 PM, Walter Lee Davis wrote:

What file-type extension do these GC files have? You could probably set a mime-type on your server and have this all happen quite automagically IF there’s a known mime-type for that file extension. The developer of GC will have registered that file-type with the Mac at installation time, and GC will respond like any good “helper” application by opening the file and coming to the front, as long as the owner of the Mac has left the default settings alone. If they’re security conscious, and turned off the “Open ‘safe’ files” option in Safari, then the file will just sit there in the Downloads tray, but at least then a double-click will launch the correct application to open it.

Walter

It’s a .gcf extension. I don’t know anything about setting mime-types, I’m just using Comcast. Safari doesn’t have an “Open safe files” option, which seems like a big drawback to me. I’m going to check out some other browsers. It’s a nuisance to have to download, take off the text extension “.txt”, and finally open the file. By default, Safari is opening the file as text on the same web page, which is just about totally useless.

Thanks for the help, though.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It’s a nuisance to have to download, take off the text extension “.txt”, and finally open the file.

Alternatively just zip the file and offer the zipped file as a download. I know you still have to unzip/unstuff but no file extension problems to worry about.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Well, there doesn’t seem to be an official mime-type for that, but you
could use the catch-all application/octet-stream as the type, that
just says “don’t mess with me, I’m binary”.

When you say you’re just on Comcast, do you mean you are hosting the
files from Comcast’s “home sharing” service?

If not, try searching this list from the home page (so you search all
of the Freeway lists at once) for the word ‘ForceType’. That will
bring up a number of references to a recipe for an .htaccess file
command to do precisely what you need. (You might even try using it
even if you’re hosted with Comcast – it can’t hurt, and you’ll know
right away if it didn’t work because your site will be blank or have a
500-series error page. Take away the command and all will be well
again. And then you can start looking for a real hosting provider, too!)

Walter

On Feb 3, 2010, at 4:25 AM, Christopher Young wrote:

On Feb 2, 2010, at 4:55 PM, Walter Lee Davis wrote:

What file-type extension do these GC files have? You could probably
set a mime-type on your server and have this all happen quite
automagically IF there’s a known mime-type for that file extension.
The developer of GC will have registered that file-type with the
Mac at installation time, and GC will respond like any good
“helper” application by opening the file and coming to the front,
as long as the owner of the Mac has left the default settings
alone. If they’re security conscious, and turned off the “Open
‘safe’ files” option in Safari, then the file will just sit there
in the Downloads tray, but at least then a double-click will launch
the correct application to open it.

Walter

It’s a .gcf extension. I don’t know anything about setting mime-
types, I’m just using Comcast. Safari doesn’t have an “Open safe
files” option, which seems like a big drawback to me. I’m going to
check out some other browsers. It’s a nuisance to have to download,
take off the text extension “.txt”, and finally open the file. By
default, Safari is opening the file as text on the same web page,
which is just about totally useless.

Thanks for the help, though.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

And then you can start looking for a real hosting provider, too!

Yes I did suggest that to Chris in response to an earlier posting he made.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Feb 3, 2010, at 5:49 AM, DeltaDave wrote:

It’s a nuisance to have to download, take off the text extension “.txt”, and finally open the file.

Alternatively just zip the file and offer the zipped file as a download. I know you still have to unzip/unstuff but no file extension problems to worry about.

David

Thanks, I’ll try that.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Feb 3, 2010, at 8:25 AM, Walter Lee Davis wrote:

Well, there doesn’t seem to be an official mime-type for that, but you could use the catch-all application/octet-stream as the type, that just says “don’t mess with me, I’m binary”.

OK, I’ll also try that.

When you say you’re just on Comcast, do you mean you are hosting the files from Comcast’s “home sharing” service?

I’m not using any of Comcast’s ready-to-go web pages, just their storage area for saving my site on.

If not, try searching this list from the home page (so you search all of the Freeway lists at once) for the word ‘ForceType’. That will bring up a number of references to a recipe for an .htaccess file command to do precisely what you need. (You might even try using it even if you’re hosted with Comcast – it can’t hurt, and you’ll know right away if it didn’t work because your site will be blank or have a 500-series error page. Take away the command and all will be well again. And then you can start looking for a real hosting provider, too!)

Sounds like a good suggestion. Thanks!

Walter

Christopher O. Young
email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Feb 3, 2010, at 2:26 PM, DeltaDave wrote:

And then you can start looking for a real hosting provider, too!

Yes I did suggest that to Chris in response to an earlier posting he made.

David

If I can’t get these files to open automatically when I’m hosted by Comcast, I’ll definitely look into that.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Feb 3, 2010, at 5:03 PM, Christopher Young wrote:

Well, there doesn’t seem to be an official mime-type for that, but you could use the catch-all application/octet-stream as the type, that just says “don’t mess with me, I’m binary”.

OK, I’ll also try that.

With the Opera browser, I was able to add a new application, and set the mime type to “application/octet-stream”. It seems to work; I can finally open files with one click!

Thanks again for the help.

Chris


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is only working for you, on your particular copy of Opera – just
so you know. To make this universal, so others can have the same
effect, you need to add that mime-type to the server.

Walter

On Feb 4, 2010, at 5:10 AM, Christopher Young wrote:

On Feb 3, 2010, at 5:03 PM, Christopher Young wrote:

Well, there doesn’t seem to be an official mime-type for that, but
you could use the catch-all application/octet-stream as the type,
that just says “don’t mess with me, I’m binary”.

OK, I’ll also try that.

With the Opera browser, I was able to add a new application, and set
the mime type to “application/octet-stream”. It seems to work; I can
finally open files with one click!

Thanks again for the help.

Chris


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Feb 4, 2010, at 10:38 AM, Walter Lee Davis wrote:

This is only working for you, on your particular copy of Opera – just so you know. To make this universal, so others can have the same effect, you need to add that mime-type to the server.

Walter

Thanks for the tip.

Which means Comcast, I assume. Seems like it would be easier to just tell everybody how to add the mim-type on their own computer. And/or furnish an Applescript that watches their downloads folder for a .gcf file to come in.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options