Results 1 to 3 of 3
  1. #1

    Sketchware Free Version: Check for FTP in URL

    Hi. I am using sketchware to develop some apps. It is the free version. I created something who's algorithm works for now, but it's not pretty, as it makes VERY strong use of external programs, and is too much like a "shortcut" app. What I would like, is to be able to view the website in a webview, which is easily accomplished. However, then the download links will not work. The download links are FTP links.

    They are not first level links, they are organized within a tree. So I'm thinking that if I checked every URL on page finished, to see if the URL was an FTP link or not, and if so, tell it to download, via a tutorial I found that doesn't work as is for my scenario, then that would work. But I'm having trouble checking the FTP part with things such as the substring block. In the tutorial, a, b, and c variable labels was not very helpful. Their bad programming habbit, makes it hard to understand their block logic. If they would have called it url and url2 even, it would be better. I had to dig to find out that the variables were URLs. It's hard to memorize their function, being a, b and c. Anyway, please help with the tutorial type logic to do this.

    Also, the if statement definitely MUST be in the code, or it won't work. It will assume everything is something to be downloaded if I don't do that.

  2. #2
    Member
    Join Date
    Jan 2018
    Posts
    5

    Original Poster
    So I learned code injection, and tried that, according to a tutorial. It didn't work either. I used the insert source block.



  3. #3
    Member
    Join Date
    Jan 2018
    Posts
    5

    Original Poster
    Success! I was able to use code injection, via add source directly. My code was:

    Code:
    Uri uri = Uri.parse(url2);
    proto = uri.getScheme();
    Then, I tested the proto for "ftp". I used the non-injection method of downloading to download if this was true. I did this in the onPageFinished() event. This worked very smoothly!

    It will only invoke the download process of another link, if the protocol is ftp that we are asking for in the URL (URI). Cool!



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •