Re: osx open url vs osascript FYI
for opening documents plugin https://github.com/miyako/4d-plugin-shell-execute component (internally LAUNCH EXTERNAL PROCESS) https://github.com/miyako/4d-component-sublaunch in particular, the escaping of paths is quite robust, not just double-quoting the whole string. but going back to the original post, I wonder why OPEN URL could not open "some" files. perhaps the HTML in question was downloaded, and GateKeeper or some other mechanism is blocking the operation? would xattr -c {drop the file here} in terminal solve the issue? ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: osx open url vs osascript FYI
David This works for me launching(all sorts of) documents..(OSX there is a another bit bit i have for windows) $_t_DocumentPath:=<—full path to document If (Test path name($_T_DocumentPath)=Is a document) $_t_PosixPath:=Convert path system to POSIX($_t_DocumentPath) $_t_FilePath:=$_t_char+$_t_PosixPath+$_t_Char $_t_applicationName:=UTIL_GetDocApps ($_t_DocumentType;True) //do some stuff to check what app they want(not entirely necessary This will only ask once!-so could be launching an HTML doc with preferred browser for example If ($_t_applicationName#"") //now we must checkt the applicaiton exist $_t_ApplicationPath:=System folder(Applications or program files) If (Not(Test path name($_t_ApplicationPath+$_t_applicationName)=Is a document)) //i am not faffing about looking for apps installed somewhere else.. LAUNCH EXTERNAL PROCESS("open "+Char(34)+$_t_PosixPath+Char(34)) Else LAUNCH EXTERNAL PROCESS("open -a "+Char(34)+$_t_applicationName+Char(34)+" "+Char(34)+$_t_FilePath+Char(34)) End if Else LAUNCH EXTERNAL PROCESS("open "+Char(34)+$_t_PosixPath+Char(34)) End if > On 13 Mar 2017, at 07:08, David Ringsmuth via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Bernd, > > Yes, html was what I first tried. > > David Ringsmuth > > From: Bernd Fröhlich via 4D_Tech > Sent: Saturday, March 11, 2017 4:57 AM > To: 4d_tech@lists.4d.com > Cc: Bernd Fröhlich > Subject: Re: osx open url vs osascript FYI > > David Ringsmuth: > >> I tried many different things to launch a .htm on OSX using OPEN URL, and it >> would not automatically open the document. > > > Have you tried using ".html" instead of ".htm"? > What happens if you doubleclick your .htm-document in the finder? > > Greetings from Germany, > Bernd Fröhlich > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** > > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: osx open url vs osascript FYI
Bernd, Yes, html was what I first tried. David Ringsmuth From: Bernd Fröhlich via 4D_Tech Sent: Saturday, March 11, 2017 4:57 AM To: 4d_tech@lists.4d.com Cc: Bernd Fröhlich Subject: Re: osx open url vs osascript FYI David Ringsmuth: > I tried many different things to launch a .htm on OSX using OPEN URL, and it > would not automatically open the document. Have you tried using ".html" instead of ".htm"? What happens if you doubleclick your .htm-document in the finder? Greetings from Germany, Bernd Fröhlich ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: osx open url vs osascript FYI
David Ringsmuth: > I tried many different things to launch a .htm on OSX using OPEN URL, and it > would not automatically open the document. Have you tried using ".html" instead of ".htm"? What happens if you doubleclick your .htm-document in the finder? Greetings from Germany, Bernd Fröhlich ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: osx open url vs osascript FYI
Hi David, > On Mar 10, 2017, at 5:04 PM, David Ringsmuth via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > It should be “open”. (SORRY) Applescript is a good option if you need to do something complicated. If you just want to open an application or document (or application with a document), Mac OS provides a great command line utility called "open". Type "man open" in Terminal to see the options. All you need to do is convert your path to posix format and put it in double quotes in case it contains spaces. This works great for doing things like opening HTML documents with Excel (use -b com.microsoft.Excel). John DeSoi, Ph.D. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: osx open url vs osascript FYI
Tim, Good catch! I copied the wrong code example. It should be “open”. (SORRY) > $script_t:="tell application \"Finder\""+$LF > $script_t:=$script_t+"open\""+$Path_Doc_t+"\" as alias"+$LF > $script_t:=$script_t+"end tell"+$LF > LAUNCH EXTERNAL PROCESS("osascript > -";$script_t;$outputStream_t;$errorStream_t) David Ringsmuth From: Tim Nevels via 4D_Tech Sent: Friday, March 10, 2017 5:03 PM To: 4d_tech@lists.4d.com Cc: Tim Nevels Subject: Re: osx open url vs osascript FYI On Mar 10, 2017, at 9:12 AM, David Ringsmuth wrote: > 4D v15.2 > OSX 10.12+ > > I tried many different things to launch a .htm on OSX using OPEN URL, and it > would not automatically open the document. > > Included “safari” in the OPEN URL. > Used the “*” parameter in OPEN URL. > Stripped the volume name. > Removed Document Type and Creator, replaced with 4*char(0). > Added the Type in CREATE DOCUMENT. > > So I used: > > $outputStream_t:="" > $errorStream_t:="" > > $LF:=Char(Line feed) > > $script_t:="tell application \"Finder\""+$LF > $script_t:=$script_t+"print \""+$Path_Doc_t+"\" as alias"+$LF > $script_t:=$script_t+"end tell"+$LF > LAUNCH EXTERNAL PROCESS("osascript > -";$script_t;$outputStream_t;$errorStream_t) > > This works great! I am confused by this post. Your first statement is you are trying to OPEN an .htm document on macOS. But your AppleScript code will not open the document, it PRINTs it. Tim Tim Nevels Innovative Solutions 785-749-3444 timnev...@mac.com ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: osx open url vs osascript FYI
On Mar 10, 2017, at 9:12 AM, David Ringsmuth wrote: > 4D v15.2 > OSX 10.12+ > > I tried many different things to launch a .htm on OSX using OPEN URL, and it > would not automatically open the document. > > Included “safari” in the OPEN URL. > Used the “*” parameter in OPEN URL. > Stripped the volume name. > Removed Document Type and Creator, replaced with 4*char(0). > Added the Type in CREATE DOCUMENT. > > So I used: > > $outputStream_t:="" > $errorStream_t:="" > > $LF:=Char(Line feed) > > $script_t:="tell application \"Finder\""+$LF > $script_t:=$script_t+"print \""+$Path_Doc_t+"\" as alias"+$LF > $script_t:=$script_t+"end tell"+$LF > LAUNCH EXTERNAL PROCESS("osascript > -";$script_t;$outputStream_t;$errorStream_t) > > This works great! I am confused by this post. Your first statement is you are trying to OPEN an .htm document on macOS. But your AppleScript code will not open the document, it PRINTs it. Tim Tim Nevels Innovative Solutions 785-749-3444 timnev...@mac.com ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
osx open url vs osascript FYI
4D v15.2 OSX 10.12+ I tried many different things to launch a .htm on OSX using OPEN URL, and it would not automatically open the document. Included “safari” in the OPEN URL. Used the “*” parameter in OPEN URL. Stripped the volume name. Removed Document Type and Creator, replaced with 4*char(0). Added the Type in CREATE DOCUMENT. So I used: $outputStream_t:="" $errorStream_t:="" $LF:=Char(Line feed) $script_t:="tell application \"Finder\""+$LF $script_t:=$script_t+"print \""+$Path_Doc_t+"\" as alias"+$LF $script_t:=$script_t+"end tell"+$LF LAUNCH EXTERNAL PROCESS("osascript -";$script_t;$outputStream_t;$errorStream_t) This works great! David Ringsmuth ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **