Page 2 of 2

Re: Check file existence on Server

Posted: Fri Feb 01, 2013 9:17 pm
by Simon
Hi alemrantareq,
Actually you just have to give us the real URL to the file.
I'm sure I can think of a name of a file that's not there :D

Simon

Re: Check file existence on Server

Posted: Sat Feb 02, 2013 9:20 pm
by alemrantareq
Simon wrote:Hi alemrantareq,
Actually you just have to give us the real URL to the file.
I'm sure I can think of a name of a file that's not there :D

Simon
Nope, the file exists in the server. If I put the file url in IDM, it downloads the file successfully. But I can't catch the file through rev :(

Is there any way to call IDM & post the url in IDM to download the file automatically? I'm talking abt auto script !! I wonder if its really possible for rev :D

Re: Check file existence on Server

Posted: Sat Feb 02, 2013 10:45 pm
by Simon
I think you misunderstood me:

Code: Select all

put URL "http://mysiteurl.com/file.rar" into myData
   put the result into rslt
   if rslt is empty then
    answer "Found"
   else
      answer "Not Found"
   end if
Works fine on my server, if the file is there it says Found, if the file is not there it says Not Found.
Of course I use a URL towards my server.
What I was asking was for you to post your real URL (Not http://mysiteurl.com/) so that we could test what the feedback was from your server.

Simon

Re: Check file existence on Server

Posted: Sun Feb 03, 2013 5:17 am
by Steve Denney
You only want to check for files on one server, right?
So the file will either be there or you'll get whatever page you get at that website when there's a file not found.
You almost had it with...
"put URL "http://thesiteurl.com/file.rar" into myData
put the result into rslt
if rslt contains "file.rar" then
// download will start"
Instead test for the opposite, test for html from the failure page.
Like this...

put URL "http://thesiteurl.com/bogusfile.pox" into msg
This will give you the html for the failure page.
Then use some string from that failure page to do your test.

Code: Select all

put URL "http://thesiteurl.com/file.rar" into myData
if theFailString is in myData then
  exit to top // or whatever, it's a fail
else
  //download as planned
end if
Can't see why this won't work 8)

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 7:32 am
by alemrantareq
Well guys, thanks a lot for the replies. I've tried all the codes that you suggested; but my bad, I always get the same result whether the file exists or not.

Here I give a link that exists on the server -

Code: Select all

http://www.kassio.altervista.org/jdscript_a/JD-17-2-2013.zip
And here is a link that doesn't exist on the server -

Code: Select all

http://www.kassio.altervista.org/jdscript_a/JD-18-2-2013.zip
Now can anyone help me to get the msg of real file existance? replies will b most appreciated :)

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 8:06 am
by Simon
I don't see the file at "http://www.kassio.altervista.org/jdscri ... 2-2013.zip"
Type that into your browser and there is a redirect page. Not the file.
Even the listed url "http://bc.vc/11513/http://www.kassio.al ... 2-2013.zip" leads to a downloader page.

You'll need a file stored in a location that can be downloaded with just the url.

Simon

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 8:18 am
by alemrantareq
Did you check the link with IDM? It starts the download immediately both in IDM & in my browsers !!! If your browser doesn't integrated with IDM, then the link wont work.

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 8:23 am
by Simon
Do you have a plugin for that site?
What is IDM? Do you mean IDE?

I tried it in the IDE and it did not work.
It correctly downloads the download page but not the file!


Simon

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 8:44 am
by Simon
Here to help you understand try this:

Code: Select all

on mouseUp
   put URL "http://www.philmrev.on-rev.com/dragon.png" into myData
   put the result into rslt
   if rslt is empty then
    answer "Found"
   else
      answer "Not Found"
   end if
end mouseUp
Then try http://www.philmrev.on-rev.com/dragon.png in a browser, you will see the picture not a different page.
Try "http://www.philmrev.on-rev.com/dragon_file_not_here.png" in the above mouseUp handler you will see that you get a 404 and the file is not found.

Simon

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 9:03 am
by alemrantareq
Yes bro, your code works for other files perfectly. But I actually want to download from that server. IDM = Internet Download Manager. I think that server uses a javascript to download the file which can be caught by IDM perfectly.

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 9:10 am
by Simon
Would have helped here if you mentioned that you were using a 3rd party product to download.
"put url" only grabs the file at the given url not implement a downloader.
It wont work in your application.

Simon

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 10:50 am
by alemrantareq
Bro, I mentioned here is there any way to call IDM & download through it -

http://forums.runrev.com/viewtopic.php? ... =15#p68787

That would be easy rather than downloading through rev app :)

Re: Check file existence on Server

Posted: Wed Feb 27, 2013 3:45 pm
by sturgis
Might try starting up a hidden revbrowser instance, point it to the location and see if it will kick in the download manager.

If it works you might be able to use the browserdownloadrequest message which will hopefully give you the actual real url to the download (rather than the mangled indirect one they have you use so that the download manager etc can be brought into play)

Hopefully though the download manager will kick in on its own and you can just let it do it's thing. Hopefully any installed IDM plugin will still work through revbrowser.

Re: Check file existence on Server

Posted: Fri Mar 01, 2013 6:31 am
by alemrantareq
Dear sturgis, thanks for the reply. Well, I never used hidden revbrowser instance and browserdownloadrequest message in any of my past projects. I've gone through the dictionary; but its not sufficient for me to start with. Can you please give me a sample script; so that I can go into deep of it. Thanks :)

Re: Check file existence on Server

Posted: Fri Mar 01, 2013 2:41 pm
by sturgis
You might want to click the resources button on the livecode coolbar, then open up the internet section on the left. Then click on "browser sampler" and download the stack.


You can learn a lot about the revbrowser that way.

Don't have time this morning to give an example but..

In the dictionary look at revbrowseropen, revbrowserclose, browserdocumentcomplete, anything starting with revbrowser
Also look at browserdownloadrequest.. If you receive that message it is possible that the url that is passed in the message is the real download URL so if the download doesn't start automatically you might be able to use that url and manually start your download manager (maybe using launch or shell or even open process) and pass the url to it.

Gotta run, good luck!