Chuck,
Yeah, using WA OPEN URL to open pdfs was a great hack for a while. Those
were the days. I do this a lot and finally had to abandon it because of the
sorts of issues you report. I resorted to this method for opening files. I
am certain I got most of the details from reading something Miyako posted.
I've been using if for a while and works with PDFs and pretty much any
other type of file.

  // Method: File_open (text) -> text
  // $1 is full path to a file
  // $0 is err msg
  // Purpose: attempt to open the file on the current user machine
  // Works on Mac & Windows
  // ** Will not open files on 4D Server **
C_TEXT($1)
C_TEXT($errMsg;$0)
C_TEXT($script)
Case of
  : (Application type=4D Server)  // no, no no
    $errMsg:="You can't use this command on the server."

  : (Count parameters=0)
    $errMsg:="No document specified."

  : (Test path name($1)#Is a document)
    $errMsg:="Invalid document path."

  : (Folder separator=":")  // macintosh
    $script:="open \""+Convert path system to POSIX($1)+"\""
    SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"true")
    LAUNCH EXTERNAL PROCESS($script)

  Else   //  windows
    $script:="Invoke-Item '"+$1+"'"
    $errMsg:=PS_ExecuteCommand ($script)
End case

$0:=$errMsg

​and the Powershell execute method is:

​
  // PS_ExecuteCommand ( text{;text}) -> text
  // $1 is command
  // $2 is exe mode - default is 'synchronous'
  // $0 is result - includes error string
  // Purpose: executes $1 in powershell  - only valid on Windows machines
  //  $PS_Call:="powershell &"+Char(Quote)+$1+Char(Quote)

C_TEXT($1;$Command)
C_TEXT($2;$ExecutionMode)  // synchronous (default) | asynchronous
C_TEXT($0;$Result)
C_TEXT($Input;$Error;$PS_Call)

$Command:=$1
If (Count parameters>1)
  $ExecutionMode:=$2
Else
  $ExecutionMode:="synchronous"
End if

$Result:=""
$Input:=""  // input stream not supported

$PS_Call:="powershell "+Char(Double quote)+$Command+Char(Double quote)

SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"true")
  // --------------------------------------------------------
  //
If ($ExecutionMode="asynchronous")
  SET ENVIRONMENT VARIABLE("_4D_OPTION_BLOCKING_EXTERNAL_PROCESS";"false")
  LAUNCH EXTERNAL PROCESS($PS_Call)
Else
  SET ENVIRONMENT VARIABLE("_4D_OPTION_BLOCKING_EXTERNAL_PROCESS";"true")
  LAUNCH EXTERNAL PROCESS($PS_Call;$Input;$Result;$Error)
End if
  //
  // --------------------------------------------------------
If ((OK=0) | ($Error#""))
  $0:="Error: "+$Error
Else
  $0:=$Result
End if


On Thu, Nov 16, 2017 at 9:13 AM, Charles Miller via 4D_Tech <
[email protected]> wrote:

> Hi All,
>
> I am using this command to open a pdf file on a 4D form. It does not work
> on everyones mac. (I don’t know about PC’s) I have the web area set as
> follows:
> opem external link checked
> Use integrated web kit checked
> Access 4D methods checked
>
> Preview is default pdf viewer on both machines that work and those that do
> not.
>
> Even with that setting, on my machine PDFs open in my 4D window with an
> acrobat look and feel
>
> On another machine they open with a preview look and feel.
>
> Is there anyway I can set to use preview on a MAC and reader on a PC
> programatticaly
>
> Any ideas why one machine might be having this problem. That machine has
> acrobat professional installed
>
> Thanks and regards
>
> Chuck
>
> --
> ------------------------------------------------------------
> -----------------------------
>  Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
>  Informed Solutions, Inc.
>  Brookline, MA 02446 USA Registered 4D Developer
>        Providers of 4D, Sybase & SQL Server connectivity
>           http://www.informed-solutions.com
> ------------------------------------------------------------
> -----------------------------
> This message and any attached documents contain information which may be
> confidential, subject to privilege or exempt from disclosure under
> applicable law.  These materials are intended only for the use of the
> intended recipient. If you are not the intended recipient of this
> transmission, you are hereby notified that any distribution, disclosure,
> printing, copying, storage, modification or the taking of any action in
> reliance upon this transmission is strictly prohibited.  Delivery of this
> message to any person other than the intended recipient shall not
> compromise or waive such confidentiality, privilege or exemption
> from disclosure as to this communication.
> **********************************************************************
> 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:[email protected]
> **********************************************************************




-- 
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**********************************************************************
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:[email protected]
**********************************************************************

Reply via email to