My question is how do I know when the files are done being copied to the
LAN directory from the other process and I can grab them with my WP8
macro (FileOpen)? If I get the file to quick, I will get the error
"This document is in use or is specified as read-only. You may edit the
document, but you must save it with a new name. Continue?"
In M$ Word when I tried to open a file that was not done copying, I
would get an error number that I could interrogate.
In WP8 I can't find any command or system variable to check on if it is
OK to open a file after all the contents of the file have been copied to
a directory.
Do I have to use the FileSize command to check for a certain size of the
file before I try to open it?
Thanks!
--
Brian Cecava
Ameritas Life Insurance Corp.
http://www.ameritas.com
Have you tried the OnError statement to try to trap the error message?
Hope this helps,
CEF
"Brian Cecava" <bce...@ameritas.com> wrote in message
news:3A11436F...@ameritas.com...
I have not tried the OnError statement. Would the code look something like
this?
Application (WP; "WordPerfect"; Default!; "EN")
OnError call (FileOpenError)
while (FileOpen("ABC.WPD"))
endwhile
OnError ()
Procedure FileOpenError()
MessageBox or write to log file about error opening file. Will retry.
EndProc
Brian
Yes, you got it. I am not sure the OnError will trap this kind of error but
it is worth a try. Depending on whether you want an error message displayed
or a log file created you could just loop, with no error message, until the
file is done or you could display the error message for 2 or 3 seconds and
then try to access the file again.
Hope this helps,
CEF
"Brian Cecava" <bce...@ameritas.com> wrote in message
news:3A1A96F8...@ameritas.com...
One thing I forgot to mention, a Procedure is not really required unless you
plan on passing values back and forth. A label should work just fine.
Really, either way should work.
CEF
"Charles E Finkenbiner" <Char...@MailandNews.Com> wrote in message
news:3a1ad2c4@cnews...
I overlooked something in my earlier post. When you 'Call' a procedure or
label, the way you want to use it in your code, you need to have a 'Return'
statement at the end. This will allow the loop you are looking for, until
the file is finished being copied.
Hope this helps,
CEF
"Charles E Finkenbiner" <Char...@MailandNews.Com> wrote in message
news:3a1ad6f8@cnews...
HTH,
Chip Orange
repeat
hFile:=OpenFile (Name:"C:\copy of a.txt"; AccessMode:Read!;
ShareMode:Exclusive!; DataType:AnsiText!)
Until( hFile > 0)
CloseFile( HFile)
The above assumes the file exists. If there is a chance that the file
doesn't even exist, check to see if hFile = -1 after the OpenFile command,
as in:
repeat
hFile:=OpenFile (Name:"C:\copy of a.txt"; AccessMode:Read!;
ShareMode:Exclusive!; DataType:AnsiText!)
If( hFile = -1)
//we know that the file doesn't exist. Do something special?
EndIf
Until( hFile > 0)
CloseFile( HFile)
Have a nice day!
James