O$ 10.2 prompt for a PDF file location

Jim Pistrang jim at jpcr.com
Tue Apr 13 19:30:56 UTC 2021


Hi Andy,

Not quite, but this pointed me to a solution.  When I let the system trigger a prompt in the $endprint method then $root.$prefs.$reportfile stays empty after the prompt.  But if I manually prompt for a name & destination and then put the resulting path into $root.$prefs.$reportfile the $endprint method knows not to prompt.

My $endprint code in the superclass now looks like this:

********************************************************* 
If pos('PDF',upp(sys(24)))>0 ## if this is a PDF we prompt here for the file name & location
  Do FileOps.$putfilename(pPath,pPromptText,'*.pdf') Returns %flag
  If not(len(pPath))
    Quit method kFalse
  End If
  Do $root.$prefs.$reportfile.$assign(pPath) ## put the destination path here so Do default doesn't generate another prompt
End If

Do default

If pos('PDF',upp(sys(24)))>0 ## this is a PDF print request
  OK message Print Complete {A PDF file has been sent to your requested destination.}
End If
********************************************************* 

Jim

>Jim
>
>Not sure about the cancel, but $root.$prefs.$reportfile is where the
>destination should be ending up, so maybe clear that first then test
>after to see if that indicates a cancel ???
>
>Andy Hilton
>Totally Brilliant Software Inc
>Phone (US) : (863) 409 4870 
>Phone (UK) : 0207 193 8582
>Web : www.totallybrilliant.com <http://www.totallybrilliant.com/> 
>Helpdesk : http://totallybrilliant.kayako.com
>Email : andyh at totallybrilliant.com
>
>> On Apr 13, 2021, at 11:15 AM, Jim Pistrang <jim at jpcr.com> wrote:
>> 
>> Hi all,
>> 
>> I'm running Studio 10.2 desktop.  I am running a report - I prompt the
>user for report destination, the user selects PDF, and I alculate
>$cdevice as kDevOmnisPDF.  When the report runs its $endprint Omnis puts
>up a prompt for the file name/destination.  The user enters the file
>name and selects the destination folder, clicks OK, and the PDF ends up
>in the folder.  I then pop up an OK message telling the user that the
>PDF has been created.  All is good.
>> 
>> What I can't figure out is how to know if the user pressed Cancel on
>the file name/destination prompt, in which case I won't want to pop up
>an OK message.  The Cancel doesn't seem to set a flag.  I thought maybe
>I could see the destination path in a sys() value and it would be empty
>on a Cancel, but I don't see it anywhere.
>> 
>> Any ideas on how I can trap for the Cancel?
>> 
>> Jim
>> 
>> -- 
>> Jim Pistrang
>> JP Computer Resources
>> 413-237-5710
>> <https://jpcr.com>
>> 
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
>
>_____________________________________________________________
>Manage your list subscriptions at http://lists.omnis-dev.com
>Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
>

-- 
Jim Pistrang
JP Computer Resources
413-237-5710
<https://jpcr.com>




More information about the omnisdev-en mailing list