8 Replies Latest reply on Aug 16, 2015 8:16 AM by Pickory

    f..execute ( ); Mac 10.10.1

    Pickory Level 3

      Hello,

       

      I use f..execute ( ); to open a file in the default browser, this seems to be broken in Mac CS6 and CC 2014. I haven't tried CC 2015 yet.

       

      I am not much good at Apple script, not really sure I want to go that route. Could I do some thing like this. Tell finder to open file with?

       

      P.

        • 1. Re: f..execute ( ); Mac 10.10.1
          Peter Kahrel Adobe Community Professional & MVP

          You have two dots in your statement, should be one dot.

          • 2. Re: f..execute ( ); Mac 10.10.1
            Pickory Level 3

            Sorry, a typo.

             

            Still doesn't work on 10.10.1

             

            P.

            • 3. Re: f..execute ( ); Mac 10.10.1
              Ronald63 Level 4

              Hi,

               

              Working with CS6-CC2104-CC2015 on 10.10.4

               

              var f = File ('~/Desktop/about.html')
              f.execute();
              
              • 4. Re: f..execute ( ); Mac 10.10.1
                Trevorׅ Adobe Community Professional

                Where does it open for you?  What happens when you double click on the file?

                Did you look at the info panel on finder?

                • 5. Re: f..execute ( ); Mac 10.10.1
                  Pickory Level 3

                  Hello,

                   

                  Thank you for taking to the time to investigate this. The OS was upgraded to 10.10.5, it now seems to work. I would have liked to get to the bottom of this, but the OS has gone, so I have to move on.

                   

                  Thanks again.

                   

                  P.

                  • 6. Re: f..execute ( ); Mac 10.10.1
                    Pickory Level 3

                    Hello,

                     

                    Sorry, nearly works.

                     

                    The file is opened in Safari, but the current working directory is some thing else, so the css or the images are not being read.

                     

                    If I double click the file in the finder all is well.

                     

                    This is on Mac 10.10.5, CS6.

                     

                    P.

                    • 7. Re: f..execute ( ); Mac 10.10.1
                      Trevorׅ Adobe Community Professional

                      Hi P

                       

                      If you can use doScript then it's simple enough

                      var appleScript, f = new File (File.openDialog());
                      appleScript = 'tell application "Finder" to open POSIX file "' + f.fsName + '"';
                      app.doScript (appleScript, ScriptLanguage.APPLESCRIPT_LANGUAGE);
                      

                       

                      If you can't use doScript i.e modal or not ID i.e Ai etc. then it's very tough, every method I know of has a minus, either with execution permissions or some other issue.

                      The below is the best of a bad bunch.  The bad point here being that a terminal window is created, so that probably renders it pretty useless.

                      If you only need to open the html on known machines that you can configure then there are better options but if your in some unknown wilderness then your probably lost.

                      P.s. I couldn't really test it properly as f.execute() works for me.

                       

                      I'd like to hear if anyone has a better non doScript based solution, remembering that the problem is specifically getting a html file to open on the default browser (Firefox being trickier than others) and not in Safari
                      // see http://stackoverflow.com/questions/14430312/how-to-call-a-python-or-shell-script-from-within-extendscript
                      var f, html;
                      html = new File (File.openDialog ("Pick a html file to open"));
                      if (html) {
                        html = html.fsName;
                        f = createTermUrlLancher(html)
                        f.execute()
                      }
                      function createTermUrlLancher(url) {
                        var termfile = new File(Folder.temp + "/urlLancher.term");
                        termfile.open("w");
                        termfile.writeln(
                             '''<?xml version="1.0" encoding="UTF-8"?>
                                <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
                                "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                                <plist version="1.0">
                                  <dict>
                                    <key>WindowSettings</key>
                                    <array>
                                      <dict>
                                        <key>ExecutionString</key>
                                        <string>open "''' + url + '''"</string>
                                      </dict>
                                    </array>
                                  </dict>
                                </plist>''');
                        termfile.close();
                        return termfile;
                      };
                      
                      

                       

                      Regards

                      Trevor

                      • 8. Re: f..execute ( ); Mac 10.10.1
                        Pickory Level 3

                        Hello Trevor,

                         

                        Thank you very much! Your Applescript did the trick.

                         

                        1. appleScript = 'tell application "Finder" to open POSIX file "' + f.fsName + '"'
                        2. app.doScript (appleScript, ScriptLanguage.APPLESCRIPT_LANGUAGE);

                         

                        When I am not up against a deadline I will try to figure out why execute is not working 10.10.5.

                         

                        Thank you.

                         

                        P.