has it finished Duplicating a file yet
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
has it finished Duplicating a file yet
Hi all,
If I were to do this:
put url("binfile:defaultLogo.png") into url("binfile:logo.png")
How do I know when it's finished? So that I don't call a "set the filename of img "myPic" to "logo.png"" too soon
Thanks
If I were to do this:
put url("binfile:defaultLogo.png") into url("binfile:logo.png")
How do I know when it's finished? So that I don't call a "set the filename of img "myPic" to "logo.png"" too soon
Thanks
Re: has it finished Duplicating a file yet
An "if there is a file" loop?
Simon
Code: Select all
repeat forever
if there is a file "logo.png" then
set the fileName of img 1 to "logo.png"
exit repeat
end if
end repeat
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: has it finished Duplicating a file yet
Hi Simon
Thanks for the idea. That's what I would have thought too but apparently, on a Mac anyway, it creates the file then starts putting the data into it. So as far as LC/standalone is concerned the file exists as soon as you start the copy, not just once it's finished.
Does anyone have any other ideas
Thanks
Thanks for the idea. That's what I would have thought too but apparently, on a Mac anyway, it creates the file then starts putting the data into it. So as far as LC/standalone is concerned the file exists as soon as you start the copy, not just once it's finished.
Does anyone have any other ideas
Thanks
Re: has it finished Duplicating a file yet
The URL keyword is blocking - so no checking is required 

LiveCode Development & Training : http://splash21.com
Re: has it finished Duplicating a file yet
Hi Monte,
Thanks for your response. I would have thought that too. However there then appears to be something else wrong, as when I set the filename it displays nothing the first time. If I leave it for a bit though it displays just fine. If URL is indeed 'blocking' then why would that happen? It's puzzling.
Thanks for your response. I would have thought that too. However there then appears to be something else wrong, as when I set the filename it displays nothing the first time. If I leave it for a bit though it displays just fine. If URL is indeed 'blocking' then why would that happen? It's puzzling.
Re: has it finished Duplicating a file yet
You could switch to using the "load url" command, which provides a callback when the file is fully downloaded.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: has it finished Duplicating a file yet
Hi Jacque
Great to hear your input. Unfortunately though 'load URL' only works with http and FTP but not for binfile: or file: which sucks a little. I understand why though, they're completely different protocols based around smb. So still no resolution on this one at the moment.
Anyone able to come up with something else. I'm still baffled.
Thanks all
Great to hear your input. Unfortunately though 'load URL' only works with http and FTP but not for binfile: or file: which sucks a little. I understand why though, they're completely different protocols based around smb. So still no resolution on this one at the moment.
Anyone able to come up with something else. I'm still baffled.
Thanks all
Re: has it finished Duplicating a file yet
Right, sorry, I didn't notice you were getting files from the drive. Oops.
The only other thing I can think of is to check the file length repeatedly until it stops changing. But that's pretty wasteful.
Edit: Oh wait, have you tried the open file/read file/close file method? Reading the file until eof should block.
The only other thing I can think of is to check the file length repeatedly until it stops changing. But that's pretty wasteful.
Edit: Oh wait, have you tried the open file/read file/close file method? Reading the file until eof should block.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: has it finished Duplicating a file yet
Oooh, thought we had it then. But it has got me to a solution. The problem here is that while 'read from file' will block till EOF, 'write to file' doesn't necessarily. And you have no idea on progress.Edit: Oh wait, have you tried the open file/read file/close file method? Reading the file until eof should block.
However, what I found following the train of thought was to use libURLSetStatusCallback and URLStatus on desktops and urlProgress on mobiles. It seems this is not limited to http and ftp and we get a lot of feedback. It's a lot of involved work but it should work. I will post back here my findings good or bad.
Thanks all for getting me back to sanity.
Pi