FileOps copy file mystery

Paul Mulroney pmulroney at logicaldevelopments.com.au
Thu Oct 24 00:16:10 UTC 2024


Hi Andrew,

If you're using the Omnis PDF device, it is asynchronus - it doesn't wait for the report to complete, so code will go merrily on it's way executing while the report is being generated in a separate task.

We had the same problem - sometimes the file is partially created so the file ops commands that check if the file exists succeed, but the file isn't finished being generated so copying it fails.

With the Omnis device there's a task method $pdfcomplete which is fired once the report is actually done.  You can override/create that method in the task var, and then do the copy at that point.

For our setup, because we wanted the main thread to wait for the report to be completed, we open a window with an "enter data until condition" setup, and wait until the report is done. The $pdfcomplete sets an instance var in the task variable to say that it's done, and we repeatedly call our own method $ispdfcomplete() which returns true if it's done. It's not pretty, but it works reliably on both mac and windows setups.

Regards
Paul.


> On 24 Oct 2024, at 5:49 am, surfway.bigpond.com via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> 
> Thanks Wayne for the suggestions which I did check and I do those tests and create the folder first if needed
> 
> The solution ended up coming from a previous post regarding the delay in creating the PDF and trying to copy it nanoseconds before it was created so I put a timer in and it no works 
> 
> What was and still is confusing though is before I do the copyfile I do a doesfileexist and that reports true so a mystery still to solve
> 
> The problem came about because I am changing my PDF code from 
> 
> Do $root.$prefs.$macosdesttype.$assign(kPDF) (which didn’t have a delay or the problem)
> 
> To
> 
> Calculate $cdevice as kDevOmnisPDF
> 
> 
> Andrew McVeigh
> Surfway Real Solutions
> Phone 02 44412679 Mobile 0418428016
> www.surfway.com.au
> www.berrarabeach.com.au
> 
> <http://www.surfway.com.au/> <http://www.surfway.com.au/>
>> On 24 Oct 2024, at 2:18 AM, Wayne Germann <wgermann at PACIFIC.EDU> wrote:
>> 
>> Make sure you check the permissions of where the file is and where it is going to.   Also, if you are placing the file or folder of files inside a folder that doesn't exist...you have to create it first.   
>> 
>> -----Original Message-----
>> From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of Michael Mantkowski
>> Sent: Wednesday, October 23, 2024 5:04 AM
>> To: 'OmnisDev List - English' <omnisdev-en at lists.omnis-dev.com>
>> Subject: RE: FileOps copy file mystery
>> 
>> CAUTION: This email originated from outside of Pacific. Do not click any links or open attachments if this is unsolicited email.
>> 
>> Hi Andrew,
>> 
>> Is it possible your two local variables are tied to a parameter / field / variable or time reference?  Any reversable blocks involved that be in called methods that set these variables?
>> 
>> Instead of a breakpoint, try setting up an Ok message to display those variables just before your copy command, see if they show that they are set as you think they should be.
>> 
>> Sometimes breakpoints allow the system to catchup with things that are happening in the stack that makes it hard to trace down something like this.
>> 
>> *********************************************************************
>> Michael Mantkowski
>> ClienTrax Software
>> 1-614-875-2245
>> *********************************************************************
>> 
>> 
>> -----Original Message-----
>> From: omnisdev-en On Behalf Of surfway.bigpond.com via omnisdev-en
>> Sent: Wednesday, October 23, 2024 12:16 AM
>> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
>> Cc: surfway.bigpond.com <surfway at bigpond.com>
>> Subject: FileOps copy file mystery
>> 
>> I have this line of code to copy a file from one directory to another
>> 
>> Do FileOps.$copyfile(lfrompath,ltopath) Returns lerror
>> 
>> When I run it comes up with an error 101201 even though the file and paths do exist. The file does not get copied. The variables are all local
>> 
>> So I put a breakpoint on the line to check what the lfrompath and ltopath values are and they all look correct and the line then works
>> 
>> So the Breakpoint makes it work
>> 
>> What am I missing?
>> 
>> Andrew McVeigh
>> Surfway Real Solutions
>> Phone 02 44412679 Mobile 0418428016
>> www.surfway.com.au
>> www.berrarabeach.com.au
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 


A bicycle can't stand alone; it's just two tired.
-- 
Paul W. Mulroney                                            We Don't Do Simple Pty Ltd 
pmulroney at logicaldevelopments.com.au       Trading as Logical Developments
www.logicaldevelopments.com.au                   ACN 161 009 374 
Ph: +61 8 9458 3889                                       86 Coolgardie Street
                                                                         BENTLEY  WA  6102





More information about the omnisdev-en mailing list