A loop to open downloaded file in Applescript?

Hi, so new to Applescript and hoping someone could help me. I use a script to download an image file with curl on my desktop (with the file named after the title of my Active Google Chrome tab). This works very well and as planned.

The problem is the line afterwards where I want to open this file in another application. It is not working and I don't know why. I guess it's probably trying to open the path of the URL instead of the local file? I try to save the results of this (DownloadedImage.jpg) as a variable, but do not know if I'm doing things. It's the part of the script:

game of downloadedFile to (the shell script "curl-o" & quoted form of (tabTitle, savePath & ".jpg" as text) & space & quoted form of theURL)

say application 'Preview' to Open ' "& downloadedFile & «»

Any help would be appreciated.

Your problem is quite simple.

In your script:

game of downloadedFile to (the shell script "curl-o" & quoted form of (tabTitle, savePath & ".jpg" as text) & space & quoted form oftheURL)

the variable downloadedFile will be the final text of the bomb the command script. It has nothing to do with the file downloaded. Instead, it is the text that you would have seen if you perform the curl even command in a Terminal window. There is no way to preview coerce to a file reference to open.

The good thing, however, is that you know where is the file, because you will need to pass these data in curl in the first place. For ease of maintenance, I simply create a new variable which follows the path of the file and use it in both States.

value filePath to quoted form of (tabTitle, savePath & ".jpg" as text)

the value downloadedFile to (the shell script "curl-o" & filePath & space form City of theURL)

say application "Overview" for Open the file filePath

So now, you open the filePath, not the output of the shell command.

Tags: Mac OS & System Software

Similar Questions

  • Can't open downloaded files

    I can't open downloaded files, a program that I paid for, among other things. I got the message, "choose what file you want to open the program with". On May 9, I downloaded files will be open, after that no. Please note: I ran a scan of viruses & spyware in depth and made that a retailer computer as well, we do not find the remark of a Trojan or viruses. What is a "worm"... If so, how to remove? This wonderful Vista doesn't let me system restore to May 9, (thank you Bill Gates).

    Cam someone provide a solution I haven't read by Googling? Thank you!

    Roy

    How to analyze the entries in the log file generating the program Checker (SFC.exe) resources of Microsoft Windows in Windows Vista
    http://support.Microsoft.com/kb/928228#appliesTo

    Some Windows Vista functions may not work, or Windows Vista may stop responding
    http://support.Microsoft.com/default.aspx/KB/929833#appliesTo

    Favorite sequence of tutorial - Vista Repair Options - Vista
    http://www.Vistax64.com/tutorials/101393-repair-Vista-options-preferred-sequence.html

    Have you looked at the MsConfig tool as a way to eliminate third-party programs or services as a possible cause?

    310560 How to troubleshoot by using the Msconfig utility in Windows XP
    http://support.Microsoft.com/kb/310560

    How to troubleshoot a problem by performing a clean boot in Windows Vista
    http://support.Microsoft.com/default.aspx/KB/929135

  • Could not open a file by Applescript

    With Photoshop CS6, I get an error trying to open a file. This breaks some of my scripts that continue to work with CS5.

    Copy the following code, copied almost exactly from seizure by Applescript CS6, returns

    error "Adobe Photoshop CS6 has been an error: object file any not found.» number - 43

    CheminMonFichier to switch to the Finder works perfectly well to open the alias.

    Tell application "Adobe Photoshop CS6"

    the value CheminMonFichier alias ' Macintosh HD:Users:ats:Downloads:Photoshop - CS6-AppleScript - Ref.pdf.

    Tell application "Finder".

    Open CheminMonFichier

    tell the end

    { Open CheminMonFichier like PDF with options { }class:PDF open options height:pixels 100, width 200, RGB resolutionPixel mode:: : 72, use smoothing:true page: 1, constrain proportions:false}

    tell the end

    Thank you. This tip made me go.  I ended up the alias down a CheminMonFichier the command line open. This method works.

    say application "Adobe Photoshop CS6.

    game of CheminMonFichier to ' HD:Users:ats:Downloads:Photoshop Macintosh-CS6-AppleScript - Ref.pdf.

    Open alias CheminMonFichier in PDF with options {class:PDF open options, height: 100,Pixel , width:Pixel 200, mode: RGB, resolution: 72, use anti-aliasing: true, page: 1, constrain proportions: false}

    end say


  • Can't open downloaded files, and I'm not able to view the items in the downloaded files.

    -Very well, every time I download a file can't open it and I view the files it contains. Say I have download a mixtape from a Web site. When it is done and get in my downloads folder, the file type is one of my programs and I can't view the contents of the downloaded file.

    Hi Ryan,

    (a) what web browser do you use?

    (b) have you been able to open this type of file before? You get a specific error message?

    (c) does it happen with every file download or it?

    Please provide the information above to understand the question better; the following steps are worth a try:

    Downloaded file is possibly corrupted. In this case, you will not be able to open it. Download the file again. That might solve the problem.

    Security software may be blocking or impeding the file to open, first of all, let us disable the security software and test

    Step 1: Disable security software, follow the steps mentioned below

    http://Windows.Microsoft.com/en-us/Windows-Vista/disable-antivirus-software

    Important: Activate security software once everything is done.

    Step 2: Download the file to a different location (on the desktop) and test

    Step 3: You can uninstall and reinstall the program that opens this file type.

    Note: You can check with the manufacturer of program for ways to reinstall and activate the software.

    Thank you, and in what concerns:

    Ajay K

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • I can not open/download files attached on all sites

    IM', unable to open/download attachments from various sites IE extensions of Hotmail and Centrelink. Very frustrating, even if I can do it on my other PC! I'm missing something here?

    Hello

    1. were you able to open/download the files attached successfully earlier?

    2. what happens when you try to open or download attachments?

    3. do you get any error code or error message?

    4. have you made changes on the computer before this problem?

    5 is this problem confined to specific files or all files?

    6. what browser you use to download/open the attachments?

    If you use Internet Explorer, then I you suggest to disable add-ons, then try to download and extract.

    Follow the steps to disable add-ons:

    a. open Internet Explorer

    b. press the ALT key, and then click Tools.

    c. click on Manage Add-ons.

    d. disable add-ons by clicking on them one at a time to highlight and then click Disable.

    Note: to re-enable the modules one by one and check with what add-on, you get this error message. Disable Add-ons will not cause any problem.

    If disabling add0one did not help, then it would be better to post the same question in Windows Live Hotmail forums to get help.

    http://answers.Microsoft.com/en-us/windowslive/Forum/Hotmail

    Please respond with more information so that we could help you more.

  • Cannot open any exe files or lnk files. No picture on the desktop icon. Can't open downloaded files to fix the problem

    downloaded the movie file viewer and now cannot do anything but go online. can not download. can't do a system restore. Cannot open any programs. Help

    Hi jplovely,

    Follow the steps in the link below and check off the results: cannot open files with extensions such as.exe, .com, and.lnk on a Windows XP computer: http://support.microsoft.com/kb/923077

    With regard to:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to open downloaded files creative suite cs4

    Hello

    I recently downloaded Adobe creative suite design standard cs4 after I lost the installation disc. I have my serial number, but I'm struggling to open/run these files in the download folder. Is there a cs4 on my desktop folder. Help, please.

    Hi christopherl4345182,

    Please see the next help thread:

    How to download, install and activate Adobe applications

    Let us know if that helps.

  • Cant open downloaded files Ps 13

    I downloaded Ps elements 13 to my new laptop acer, win 10 running. The files in my download folder, but I can't do anything with them, can open, does not work, so as a result, I have to use Ps. .... Any ideas on what to do...?

    PROBLEM SOLVED... Uninstalled all downloaded Ps 13 files from my laptop. The files downloaded for the second time, everything worked well.

  • Opening downloaded files on a Mac with Acrobat 11.0

    I'm on a Mac Pro OS 10.8.2.  For downloading and installing Acrobat Pro 11.0, I can not open all PDF files downloaded from the internet.  I can always open (with Acrobat 11.0) PDF files previously downloaded with Acrobat Pro 9.5.  I get the error message-'there was an error opening this document. There was a problem reading this document (14). »

    I couldn't solve the problem.  I'm back to Acrobat Pro 9.5.2.  (I had to run all the updates overagain, 1 by 1-20 in all).  I can now download the pdf on the web files and open them again in Acrobat.  Adobe has processed a refund.

  • downloaded files more open automatically - I need to double click on it in the downloads window

    In the past when I have they automatically open downloaded files. I use Windows Vista

    The measures taken will depend in part on the type of downloaded file, then on settings do, either by yourself, or modified by one of the extensions added to firefox. See change what Firefox does when you click on or download a file and possibly also troubleshoot and diagnose problems in Firefox

    Read the article and post if you continue to have problems, good luck.

  • my laptop does not open any file I download from the hyperlink! Help, please!?

    Please help me? !!!  I think I accidentally deleted a driver needed to open downloaded files.  My laptop HP Pavilion 7000 has will not open any file that download.  I click on the hyperlink on the Web page that I want to download and the item is displayed to download and appears ("download completed").  It appears at the top of the download list.  When I click with the left button on the point and click Open or save the file, the mouse animated backgr appears momentarily and then nothing.  Nothing happens.  It won't show me page I want to see!  I tried all possible combinations.  Open the file with the software choice.  Sometimes it will open if I click Open with msworks but in gibberish.  Augh!  I've tried everything.  I closed my firewall thought that might block downloads. I deleted openoffice.org and re-installed.  I ran spysweeper, anti-virus, anti-malware...  I did a system restore... I'm at my wits end!

    Oh, thank you very much!  I was so exasperated, trying to make my laptop to open the files and your suggestion worked!  Thank you very much for taking the time to read my problem and give me a solution(:!!!)

    Thank you thank you thank you!

  • Downloaded files disappear in 5 seconds. Show all downloads in the drop-down list is empty.

    It is a new problem. Unless I immediately open downloaded files - even a PDF - they left of Firefox in about 5 seconds and I have to go to download the windows folder to retrieve. I tried to change the settings for windows defender, I searched browser.download.scanwhendone in the config, but it wasn't there.
    I have my story never save settings, but still for many years.

    You need to keep the history if you want to keep visible downloads Manager downloads and on topic: downloads page.

    Firefox handles downloads in the downloads folder in the library (history > show history)

    • Downloads are treated as elements of history: history of compensation removes items from included download and vice versa.
    • When the downloads are in progress you see a download button animation on the toolbar for Navigation showing an estimate of the remaining time
    • The download button gets a blue highlight all completed once download to make you aware that there are new downloads.
    • Suspend and resume are in the context menu of an item.
    • You can open the connection: downloads page in a tab or a window for easy access.
  • How to open a file downloaded microsoft word to macos sierra

    How to open a file downloaded microsoft word to macos sierra

    You should just be able to double-click on it since OS X built a decompression software. But unless you are sure that the source of the MS Word file is safe and secure, be careful, because a typical method of malware distribution is through such files.

  • How to open/download a file .java instead of open as a txt in a new tab in Firefox?

    Hello
    I need to download/open on my computer a file .java, but Firefox does not give me a box 'Open' or 'Download' instead, it opens the java file as text in a new tab.

    How do I download/open it on my computer?

    I guess that you are referring to a JavaScript file.
    Java and JavaScript are different languages.
    To avoid confusion, see:

    If the server sends the file as a text/plain then Firefox will open the file in a tab if you click left and does not download/save the file.
    In this case, you must save the file via the context menu or the file menu.

    You will need to click right on the link and use "save the link under" to save this file directly instead of left-clicking the link.

  • Firefox crashes when I try to open a downloaded file

    Hello!

    Whenever I try to open a file I just downloaded Firefox stops working. I get a windows "Firefox has stopped working" error message.

    Steps to follow:
    Download a file
    Download blue arrow icon will blink to indicate that the download is finished
    I click on the download arrow to open the list of downloaded files
    I clicked on the file I want to open
    Firefox crashes

    I tried the following:

    - reinstall firefox
    - refresh firefox
    - start firefox in safe mode (still crashes)
    

    I also tested in safe mode Windows and do not have the problem. According to me, indicating that there is another piece of software that is the cause of the crash, but I do not know how to identify what other software it is.

    Firefox does not record these subject aircraft crash: crashes so I have no newspaper to share.

    I have an error in the Windows Event Viewer:

    The failing application name: firefox.exe, version: 35.0.1.5500, time stamp: 0x54c1fdbc
    The failed module name: ntdll.dll, version: 6.3.9600.17630, time stamp: 0x54b0d74f
    Exception code: 0xc0000374
    Offset: 0x000e5994
    Process ID vulnerabilities: 0xcbc
    Start time of application vulnerabilities: 0x01d046499c589612
    The failing application path: C:\Program Files (x 86) \Mozilla Firefox\firefox.exe
    The failed module path: C:\WINDOWS\SYSTEM32\ntdll.dll
    Report ID: e600231d-b23c-11e4-bea1-90e6bad76e7f
    Faulting full name of the package:
    ID of the failed package-parent application:

    Any help would be great.

    OK, so this I've not exactly "resolved" the issue, but I have a solution. I dropped Firefox and installed Firefox developer edition instead:

    https://www.Mozilla.org/en-us/Firefox/developer/

    I don't have the same problem when using that. Fact.

Maybe you are looking for

  • want dv7 - 7227cl

    I just bought a new dv7 - 7227cl with 8 windows pre installed, I have an ssd (Crucial CT064M4SSD2 M4 64GB 2.5 "SATA III) I'm trying to install in the main hard drive and move that he arrived with a secondary drive, how can I reinstall windows 8 on th

  • My canon printer only prints in green.

    My canon pixma mx922 only prints in green, yellow and cyan sometimes. My theory is that the problem is caused by the ink not deployed by canon (it's ink not expensive), because the printer makes it as soon as all but a type of ink, black was not made

  • Kernel_Data_Inpage_error Stop: 0 x 00000077 (0XC0000056, 0X0C6ab000, 0XC0000056, 0x00000000)

    This error appears frequently as a blue screen.  I have to restart the laptop. I checked the SMART status of my hard disk with HD Tunes Pro and there is no bad sector. I have also checked the troubleshooting page and did not find the explanation for

  • Ultra endurance Xperia Z5 bug

    I used stamia of u. When I try to disable the ustamia, restarted phone and many apps disappeared and service game google and theme do not work normally. I did some research and saw many older devices have the same problem when they activate stamia u.

  • Recent survey of Windows Live (?) to reset the username, Passwork, Date of birth, country or territory

    I received 2 requests for Windows Live team asking me to change some of my personal information.  One is from "MSN Hotmail! «Customer service (* address email is removed from the privacy *) "and the second came from" Windows Live team (* address emai