Get url "file:///..."

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Get url "file:///..."

jim hurley
I got this web page address from the county election's office:

   file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm

It opens when I paste  it into the address field in Safari.

But

   get url "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"

in Live Code leaves "it" empty.

I need to get the source code (programmatically) so that I may parse "it" for voter results.

Is there something I can do to the address that would make it acceptable to LiveCode's: get url

Jim



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Mike Bonner
Try changing it to this: file:/Users/jimhurley/
Library/Mail%20Downloads/elec_web/precincts/241.htm

Alternatively, you can probably use a browser widget and set the url to
file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
then get the htmltext of the browser widget, (since it knows how to handle
file:///... type urls) but just eliminating the superfluous // should help.

Yet another option.  Set the default folder to "/Users/jimhurley/
Library/Mail%20Downloads/elec_web/precincts"
at which point you can simply: get URL "file:241.htm"

On Mon, Jun 20, 2016 at 5:54 PM, Jim Hurley <[hidden email]>
wrote:

> I got this web page address from the county election's office:
>
>
>  file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
>
> It opens when I paste  it into the address field in Safari.
>
> But
>
>    get url
> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
>
> in Live Code leaves "it" empty.
>
> I need to get the source code (programmatically) so that I may parse "it"
> for voter results.
>
> Is there something I can do to the address that would make it acceptable
> to LiveCode's: get url
>
> Jim
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Mike Bonner
Oh. Another bonus to setting the default folder is that if there are
muitiple files to pars, you can "get the files" and loop through then
easily.(Not that you couldn't do it without setting the folder, but...)

On Mon, Jun 20, 2016 at 6:00 PM, Mike Bonner <[hidden email]> wrote:

> Try changing it to this: file:/Users/jimhurley/
> Library/Mail%20Downloads/elec_web/precincts/241.htm
>
> Alternatively, you can probably use a browser widget and set the url to
> file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
> then get the htmltext of the browser widget, (since it knows how to handle
> file:///... type urls) but just eliminating the superfluous // should help.
>
> Yet another option.  Set the default folder to "/Users/jimhurley/
> Library/Mail%20Downloads/elec_web/precincts"
> at which point you can simply: get URL "file:241.htm"
>
> On Mon, Jun 20, 2016 at 5:54 PM, Jim Hurley <[hidden email]>
> wrote:
>
>> I got this web page address from the county election's office:
>>
>>
>>  file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
>>
>> It opens when I paste  it into the address field in Safari.
>>
>> But
>>
>>    get url
>> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
>>
>> in Live Code leaves "it" empty.
>>
>> I need to get the source code (programmatically) so that I may parse "it"
>> for voter results.
>>
>> Is there something I can do to the address that would make it acceptable
>> to LiveCode's: get url
>>
>> Jim
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Dar Scott
In reply to this post by jim hurley
urlDecode() ?

> On Jun 20, 2016, at 5:54 PM, Jim Hurley <[hidden email]> wrote:
>
> I got this web page address from the county election's office:
>
>   file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
>
> It opens when I paste  it into the address field in Safari.
>
> But
>
>   get url "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
>
> in Live Code leaves "it" empty.
>
> I need to get the source code (programmatically) so that I may parse "it" for voter results.
>
> Is there something I can do to the address that would make it acceptable to LiveCode's: get url
>
> Jim
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Mike Bonner
Ah. A combination of both.  get url urldecode(" file:/Users/jimhurley/
Library/Mail%20Downloads/elec_web/precincts/241.htm")  Still need to get
rid of the extra //.  If you check the result on fail it'll probably say
"can't open file". You'll need to urldecode to set the folder too if you
decide to go that way.

On Mon, Jun 20, 2016 at 6:23 PM, Dar Scott <[hidden email]> wrote:

> urlDecode() ?
>
> > On Jun 20, 2016, at 5:54 PM, Jim Hurley <[hidden email]>
> wrote:
> >
> > I got this web page address from the county election's office:
> >
> >
>  file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
> >
> > It opens when I paste  it into the address field in Safari.
> >
> > But
> >
> >   get url
> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
> >
> > in Live Code leaves "it" empty.
> >
> > I need to get the source code (programmatically) so that I may parse
> "it" for voter results.
> >
> > Is there something I can do to the address that would make it acceptable
> to LiveCode's: get url
> >
> > Jim
> >
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Dar Scott
Yeah, checking 'the result' sounds like a good idea.  

I don't have a problem with ///, though, on my macOS (as we say instead of OS X these days).  Maybe that part depends on the OS.  

I have a feeling that we might be missing the core of the problem.  


> On Jun 20, 2016, at 6:39 PM, Mike Bonner <[hidden email]> wrote:
>
> Ah. A combination of both.  get url urldecode(" file:/Users/jimhurley/
> Library/Mail%20Downloads/elec_web/precincts/241.htm")  Still need to get
> rid of the extra //.  If you check the result on fail it'll probably say
> "can't open file". You'll need to urldecode to set the folder too if you
> decide to go that way.
>
> On Mon, Jun 20, 2016 at 6:23 PM, Dar Scott <[hidden email]> wrote:
>
>> urlDecode() ?
>>
>>> On Jun 20, 2016, at 5:54 PM, Jim Hurley <[hidden email]>
>> wrote:
>>>
>>> I got this web page address from the county election's office:
>>>
>>>
>> file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
>>>
>>> It opens when I paste  it into the address field in Safari.
>>>
>>> But
>>>
>>>  get url
>> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
>>>
>>> in Live Code leaves "it" empty.
>>>
>>> I need to get the source code (programmatically) so that I may parse
>> "it" for voter results.
>>>
>>> Is there something I can do to the address that would make it acceptable
>> to LiveCode's: get url
>>>
>>> Jim
>>>
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Mike Bonner
On windows, I can't make it work with the extra ///, so it does appear that
os matters.Hopefully the result will give a clue

On Mon, Jun 20, 2016 at 6:52 PM, Dar Scott <[hidden email]> wrote:

> Yeah, checking 'the result' sounds like a good idea.
>
> I don't have a problem with ///, though, on my macOS (as we say instead of
> OS X these days).  Maybe that part depends on the OS.
>
> I have a feeling that we might be missing the core of the problem.
>
>
> > On Jun 20, 2016, at 6:39 PM, Mike Bonner <[hidden email]> wrote:
> >
> > Ah. A combination of both.  get url urldecode(" file:/Users/jimhurley/
> > Library/Mail%20Downloads/elec_web/precincts/241.htm")  Still need to get
> > rid of the extra //.  If you check the result on fail it'll probably say
> > "can't open file". You'll need to urldecode to set the folder too if you
> > decide to go that way.
> >
> > On Mon, Jun 20, 2016 at 6:23 PM, Dar Scott <[hidden email]> wrote:
> >
> >> urlDecode() ?
> >>
> >>> On Jun 20, 2016, at 5:54 PM, Jim Hurley <[hidden email]>
> >> wrote:
> >>>
> >>> I got this web page address from the county election's office:
> >>>
> >>>
> >>
> file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
> >>>
> >>> It opens when I paste  it into the address field in Safari.
> >>>
> >>> But
> >>>
> >>>  get url
> >>
> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
> >>>
> >>> in Live Code leaves "it" empty.
> >>>
> >>> I need to get the source code (programmatically) so that I may parse
> >> "it" for voter results.
> >>>
> >>> Is there something I can do to the address that would make it
> acceptable
> >> to LiveCode's: get url
> >>>
> >>> Jim
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> use-livecode mailing list
> >>> [hidden email]
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >>
> >> _______________________________________________
> >> use-livecode mailing list
> >> [hidden email]
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

jim hurley
In reply to this post by jim hurley
Thanks for all the suggestions. So far no luck with any.

No combination of back slashes work, and urlDecode() simply returns the file name.

Sarfari opens the file with no difficulty.

Apparently Sarfari does something that LiveCode's  "get Url" doesn't.

Jim

> Dar Scott wrote:
>
> Yeah, checking 'the result' sounds like a good idea.  
>
> I don't have a problem with ///, though, on my macOS (as we say instead of OS X these days).  Maybe that part depends on the OS.  
>
> I have a feeling that we might be missing the core of the problem.  
>

> On Jun 20, 2016, at 6:39 PM, Mike Bonner <bonnmike at gmail.com> wrote:
>
> Ah. A combination of both.  get url urldecode(" file:/Users/jimhurley/
> Library/Mail%20Downloads/elec_web/precincts/241.htm")  Still need to get
> rid of the extra //.  If you check the result on fail it'll probably say
> "can't open file". You'll need to urldecode to set the folder too if you
> decide to go that way.
>
> On Mon, Jun 20, 2016 at 6:23 PM, Dar Scott <dsc at swcp.com> wrote:
>
>> urlDecode() ?
>>
>>> On Jun 20, 2016, at 5:54 PM, Jim Hurley <jhurley0305 at sbcglobal.net>
>> wrote:
>>>
>>> I got this web page address from the county election's office:
>>>
>>>
>> file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
>>>
>>> It opens when I paste  it into the address field in Safari.
>>>
>>> But
>>>
>>>  get url
>> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
>>>
>>> in Live Code leaves "it" empty.
>>>
>>> I need to get the source code (programmatically) so that I may parse
>> "it" for voter results.
>>>
>>> Is there something I can do to the address that would make it acceptable
>> to LiveCode's: get url
>>>
>>> Jim
>>>
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Dar Scott
I think urlDecode() should convert the %20 to a space.   I don't think it would do more to the path you mentioned.  

You can check whether 'the result' is something other than "can't open file".  

You might try saving the attachment to another location and getting it from there.

You might try putting an 'answer file' just before the get to obtain the path.  

You might want to get rid of any control characters that got caught in the string as you did a copy and paste.  

Obviously, I'm running out of ideas and am babbling.  



> On Jun 20, 2016, at 7:37 PM, Jim Hurley <[hidden email]> wrote:
>
> Thanks for all the suggestions. So far no luck with any.
>
> No combination of back slashes work, and urlDecode() simply returns the file name.
>
> Sarfari opens the file with no difficulty.
>
> Apparently Sarfari does something that LiveCode's  "get Url" doesn't.
>
> Jim
>
>> Dar Scott wrote:
>>
>> Yeah, checking 'the result' sounds like a good idea.  
>>
>> I don't have a problem with ///, though, on my macOS (as we say instead of OS X these days).  Maybe that part depends on the OS.  
>>
>> I have a feeling that we might be missing the core of the problem.  
>>
>
>> On Jun 20, 2016, at 6:39 PM, Mike Bonner <bonnmike at gmail.com> wrote:
>>
>> Ah. A combination of both.  get url urldecode(" file:/Users/jimhurley/
>> Library/Mail%20Downloads/elec_web/precincts/241.htm")  Still need to get
>> rid of the extra //.  If you check the result on fail it'll probably say
>> "can't open file". You'll need to urldecode to set the folder too if you
>> decide to go that way.
>>
>> On Mon, Jun 20, 2016 at 6:23 PM, Dar Scott <dsc at swcp.com> wrote:
>>
>>> urlDecode() ?
>>>
>>>> On Jun 20, 2016, at 5:54 PM, Jim Hurley <jhurley0305 at sbcglobal.net>
>>> wrote:
>>>>
>>>> I got this web page address from the county election's office:
>>>>
>>>>
>>> file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
>>>>
>>>> It opens when I paste  it into the address field in Safari.
>>>>
>>>> But
>>>>
>>>> get url
>>> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
>>>>
>>>> in Live Code leaves "it" empty.
>>>>
>>>> I need to get the source code (programmatically) so that I may parse
>>> "it" for voter results.
>>>>
>>>> Is there something I can do to the address that would make it acceptable
>>> to LiveCode's: get url
>>>>
>>>> Jim
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Mike Bonner
In reply to this post by jim hurley
Strange.  So, this sequence doesn't work?

If you do this..

get url
urldecode("file:/Users/jimHurley/Library/Mail%20Downloads/elec_web/precincts/241.htm)")
put the result && it

(on windows this works for me: get url
urldecode("file:/Users/Mike/Desktop/test%20me/steering.txt"); put it && the
result )


If it works the result will be empty and you'll see the contents of the
file.

If it doesn't work, hopefully the result will show the error.


Did you try setting the folder method?

set the folder to
urldecode("/Users/jimHurley/Library/Mail%20Downloads/elec_web/precincts")
get url "file:241.htm"
put the result && it

(on windows this works for me: get url
urldecode("file:/Users/Mike/Desktop/test%20me/steering.txt"); put it && the
result )


I"m starting to wonder.. Did you copy and paste in the path? If so, maybe
something got lost in translation.  (I've seen a few instances where
pasting things into the script editor broke it in a big way)

Another question.. the elec_web folder.. Is it a local folder, or a network
share mapped to a directory?

On Mon, Jun 20, 2016 at 7:37 PM, Jim Hurley <[hidden email]>
wrote:

> Thanks for all the suggestions. So far no luck with any.
>
> No combination of back slashes work, and urlDecode() simply returns the
> file name.
>
> Sarfari opens the file with no difficulty.
>
> Apparently Sarfari does something that LiveCode's  "get Url" doesn't.
>
> Jim
>
> > Dar Scott wrote:
> >
> > Yeah, checking 'the result' sounds like a good idea.
> >
> > I don't have a problem with ///, though, on my macOS (as we say instead
> of OS X these days).  Maybe that part depends on the OS.
> >
> > I have a feeling that we might be missing the core of the problem.
> >
>
> > On Jun 20, 2016, at 6:39 PM, Mike Bonner <bonnmike at gmail.com> wrote:
> >
> > Ah. A combination of both.  get url urldecode(" file:/Users/jimhurley/
> > Library/Mail%20Downloads/elec_web/precincts/241.htm")  Still need to get
> > rid of the extra //.  If you check the result on fail it'll probably say
> > "can't open file". You'll need to urldecode to set the folder too if you
> > decide to go that way.
> >
> > On Mon, Jun 20, 2016 at 6:23 PM, Dar Scott <dsc at swcp.com> wrote:
> >
> >> urlDecode() ?
> >>
> >>> On Jun 20, 2016, at 5:54 PM, Jim Hurley <jhurley0305 at sbcglobal.net>
> >> wrote:
> >>>
> >>> I got this web page address from the county election's office:
> >>>
> >>>
> >>
> file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
> >>>
> >>> It opens when I paste  it into the address field in Safari.
> >>>
> >>> But
> >>>
> >>>  get url
> >>
> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
> >>>
> >>> in Live Code leaves "it" empty.
> >>>
> >>> I need to get the source code (programmatically) so that I may parse
> >> "it" for voter results.
> >>>
> >>> Is there something I can do to the address that would make it
> acceptable
> >> to LiveCode's: get url
> >>>
> >>> Jim
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> use-livecode mailing list
> >>> use-livecode at lists.runrev.com
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Mike Bonner
In reply to this post by Dar Scott
Great minds

>
> You might want to get rid of any control characters that got caught in the
> string as you did a copy and paste.
>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Monte Goulding-2
In reply to this post by jim hurley

> On 21 Jun 2016, at 11:37 AM, Jim Hurley <[hidden email]> wrote:
>
> Thanks for all the suggestions. So far no luck with any.
>
> No combination of back slashes work, and urlDecode() simply returns the file name.
>
> Sarfari opens the file with no difficulty.
>
> Apparently Sarfari does something that LiveCode's  "get Url" doesn't.

It is a quirk/anomaly of our language that file, binfile and resfile urls are not RFC1630 compliant. I’m pretty sure they were implemented before the RFC.. They are presumed to not be URL encoded and to not include “//[<host>]“. Unixes should cope fine with the extra “//“. They won’t like the URL encode path though.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

J. Landman Gay
In reply to this post by jim hurley
I generally put parentheses around the quoted file path. That forces the
engine to treat it as a container rather than a string.

Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com



On June 20, 2016 8:39:16 PM Jim Hurley <[hidden email]> wrote:

> Thanks for all the suggestions. So far no luck with any.
>
> No combination of back slashes work, and urlDecode() simply returns the
> file name.
>
> Sarfari opens the file with no difficulty.
>
> Apparently Sarfari does something that LiveCode's  "get Url" doesn't.
>
> Jim
>
>> Dar Scott wrote:
>>
>> Yeah, checking 'the result' sounds like a good idea.
>>
>> I don't have a problem with ///, though, on my macOS (as we say instead of
>> OS X these days).  Maybe that part depends on the OS.
>>
>> I have a feeling that we might be missing the core of the problem.
>>
>
>> On Jun 20, 2016, at 6:39 PM, Mike Bonner <bonnmike at gmail.com> wrote:
>>
>> Ah. A combination of both.  get url urldecode(" file:/Users/jimhurley/
>> Library/Mail%20Downloads/elec_web/precincts/241.htm")  Still need to get
>> rid of the extra //.  If you check the result on fail it'll probably say
>> "can't open file". You'll need to urldecode to set the folder too if you
>> decide to go that way.
>>
>> On Mon, Jun 20, 2016 at 6:23 PM, Dar Scott <dsc at swcp.com> wrote:
>>
>>> urlDecode() ?
>>>
>>>> On Jun 20, 2016, at 5:54 PM, Jim Hurley <jhurley0305 at sbcglobal.net>
>>> wrote:
>>>>
>>>> I got this web page address from the county election's office:
>>>>
>>>>
>>> file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm
>>>>
>>>> It opens when I paste  it into the address field in Safari.
>>>>
>>>> But
>>>>
>>>>  get url
>>> "file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
>>>>
>>>> in Live Code leaves "it" empty.
>>>>
>>>> I need to get the source code (programmatically) so that I may parse
>>> "it" for voter results.
>>>>
>>>> Is there something I can do to the address that would make it acceptable
>>> to LiveCode's: get url
>>>>
>>>> Jim
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

[-hh]
Assuming you are on a Mac:
The following should work from 10.4 to 10.12 with LC 5/6/7/8.

on mouseUp
  put "/Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm" into f
  put "source" into sOrT --> one of "source", "text", "URL"
  do iScript(f, sOrT) as applescript
  put the result into fld 1
end mouseUp

Using above "text" instead of "source" may save you some work.
(The LC interpretation as htmltext does the same but somehow 'uncomplete').

function iScript f,x
  put numToChar(34) into q
  return "tell application " &  q&"Safari"&q  &cr& \
        " open POSIX file " &  q&URLdecode(f)&q  &cr& \
        " set rslt to " & x & " of document 1" &cr& \
        "end tell"
end iScript
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

jim hurley
In reply to this post by jim hurley
Thank you so much. Sooooo useful!

Understatement of the year: "Using above "text" instead of "source" may save you some work."

It saves a mountain of parsing.

Shouldn't this be a part of LiveCode?

Jim Hurley

> Message: 1
> Date: Mon, 20 Jun 2016 22:06:41 -0700 (PDT)
> From: "[-hh]" <[hidden email]>
> To: [hidden email]
> Subject: Re: Get url "file:///..."
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=us-ascii
>
> Assuming you are on a Mac:
> The following should work from 10.4 to 10.12 with LC 5/6/7/8.
>
> on mouseUp
>  put "/Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm" into f
>  put "source" into sOrT --> one of "source", "text", "URL"
>  do iScript(f, sOrT) as applescript
>  put the result into fld 1
> end mouseUp
>
> Using above "text" instead of "source" may save you some work.
> (The LC interpretation as htmltext does the same but somehow 'uncomplete').
>
> function iScript f,x
>  put numToChar(34) into q
>  return "tell application " &  q&"Safari"&q  &cr& \
>        " open POSIX file " &  q&URLdecode(f)&q  &cr& \
>        " set rslt to " & x & " of document 1" &cr& \
>        "end tell"
> end iScript
>
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Get-url-file-tp4705988p4706007.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Klaus major-k
Hi Jim,

not sure I understand the problem, but this should give you the TEXT/source of that file:
...
put url "file:/Users/jimhurley/Library/Mail Downloads/elec_web/precincts/241.htm" into tSource
...

> Am 21.06.2016 um 15:11 schrieb Jim Hurley <[hidden email]>:
>
> Thank you so much. Sooooo useful!
>
> Understatement of the year: "Using above "text" instead of "source" may save you some work."
>
> It saves a mountain of parsing.
>
> Shouldn't this be a part of LiveCode?
>
> Jim Hurley
>
>> Message: 1
>> Date: Mon, 20 Jun 2016 22:06:41 -0700 (PDT)
>> From: "[-hh]" <[hidden email]>
>> To: [hidden email]
>> Subject: Re: Get url "file:///..."
>> Message-ID: <[hidden email]>
>> Content-Type: text/plain; charset=us-ascii
>>
>> Assuming you are on a Mac:
>> The following should work from 10.4 to 10.12 with LC 5/6/7/8.
>>
>> on mouseUp
>> put "/Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm" into f
>> put "source" into sOrT --> one of "source", "text", "URL"
>> do iScript(f, sOrT) as applescript
>> put the result into fld 1
>> end mouseUp
>>
>> Using above "text" instead of "source" may save you some work.
>> (The LC interpretation as htmltext does the same but somehow 'uncomplete').
>>
>> function iScript f,x
>> put numToChar(34) into q
>> return "tell application " &  q&"Safari"&q  &cr& \
>>       " open POSIX file " &  q&URLdecode(f)&q  &cr& \
>>       " set rslt to " & x & " of document 1" &cr& \
>>       "end tell"
>> end iScript

Best

Klaus
--
Klaus Major
http://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Dar Scott
I agree.  There is something we are missing.  (Trying to access as some other user?)

> On Jun 21, 2016, at 7:18 AM, Klaus major-k <[hidden email]> wrote:
>
> Hi Jim,
>
> not sure I understand the problem, but this should give you the TEXT/source of that file:
> ...
> put url "file:/Users/jimhurley/Library/Mail Downloads/elec_web/precincts/241.htm" into tSource
> ...
>
>> Am 21.06.2016 um 15:11 schrieb Jim Hurley <[hidden email]>:
>>
>> Thank you so much. Sooooo useful!
>>
>> Understatement of the year: "Using above "text" instead of "source" may save you some work."
>>
>> It saves a mountain of parsing.
>>
>> Shouldn't this be a part of LiveCode?
>>
>> Jim Hurley
>>
>>> Message: 1
>>> Date: Mon, 20 Jun 2016 22:06:41 -0700 (PDT)
>>> From: "[-hh]" <[hidden email]>
>>> To: [hidden email]
>>> Subject: Re: Get url "file:///..."
>>> Message-ID: <[hidden email]>
>>> Content-Type: text/plain; charset=us-ascii
>>>
>>> Assuming you are on a Mac:
>>> The following should work from 10.4 to 10.12 with LC 5/6/7/8.
>>>
>>> on mouseUp
>>> put "/Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm" into f
>>> put "source" into sOrT --> one of "source", "text", "URL"
>>> do iScript(f, sOrT) as applescript
>>> put the result into fld 1
>>> end mouseUp
>>>
>>> Using above "text" instead of "source" may save you some work.
>>> (The LC interpretation as htmltext does the same but somehow 'uncomplete').
>>>
>>> function iScript f,x
>>> put numToChar(34) into q
>>> return "tell application " &  q&"Safari"&q  &cr& \
>>>      " open POSIX file " &  q&URLdecode(f)&q  &cr& \
>>>      " set rslt to " & x & " of document 1" &cr& \
>>>      "end tell"
>>> end iScript
>
> Best
>
> Klaus
> --
> Klaus Major
> http://www.major-k.de
> [hidden email]
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Richard Gaskin
In reply to this post by jim hurley
Jim Hurley wrote:

 > I got this web page address from the county election's office:
 >
 >
file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm

How did the elections office get a path to a file on your hard drive?


 > It opens when I paste  it into the address field in Safari.
 >
 > But
 >
 >    get url
"file:///Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
 >
 > in Live Code leaves "it" empty.
 >
 > I need to get the source code (programmatically) so that I may parse
 > "it" for voter results.
 >
 > Is there something I can do to the address that would make it
 > acceptable to LiveCode's: get url

In a traditional URL what you have is good, which explains why it works
well in a browser.

"file://" is the service protocol specifier, and "/Users/jimhurley/..."
is the path to the file.

LiveCode's URL syntax for working with local files isn't quite the same,
though.  In LC, we do need the "//" when using an Internet protocol
(e.g. "http://" or "ftp://"), but for accessing local files the "file:"
or "binfile:" specifier is not treated as a service per se, merely a
keyword to let the engine know to use very different internal routines
than it uses for Internet access.

The POSIX standard that's supposed to govern these things is notoriously
inconsistent among implementations.  IIRC the spec calls for any path
that includes more than one "/" to be interpreted as if there is only
one (e.g. "///" becomes "/").  If that was happening here, then using this:

   file:///Users/jimhurley/...

...would be the same as:

   file:/Users/jimhurley/...

But apparently it isn't.

Perhaps this is a bug in LC.  Mark/Monte/Peter: opinions?

Oddly, I believe I've encountered times when "file:///" worked, but not
others (Windows?).  Maybe it's dependent on how the host OS handles
paths?  FWIW on Ubuntu it works with 1, 2, 3, and even 10 slashes.

In any event, if you change that to use a single slash you should find
that it works:

   replace "file:///" with "file:/" in tUrl
   put url tUrl into tWhatever

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

jim hurley
In reply to this post by jim hurley
Hi Klaus,

Yes, that works well. Thank you.
But it gives me the html source code.
I can live with that, but lots of parsing to get the text
You seem to suggest I can get the "text" or (?) or html "source"
hh's script (below) does that but it is very unstable, crashing frequently

Jim


Klaus wrote:
> Hi Jim,
>
> not sure I understand the problem, but this should give you the TEXT/source of that file:
> ...
> put url "file:/Users/jimhurley/Library/Mail Downloads/elec_web/precincts/241.htm" into tSource
> ...



put url "file:/Users/jimhurley/Library/Mail Downloads/elec_web/precincts/241.htm" into msg box
On Jun 21, 2016, at  3:00 AM, [hidden email] wrote:

> Send use-livecode mailing list submissions to
> [hidden email]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.runrev.com/mailman/listinfo/use-livecode
> or, via email, send a message with subject or body 'help' to
> [hidden email]
>
> You can reach the person managing the list at
> [hidden email]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of use-livecode digest..."
>
>
> you can find the archives for this list at:
>
> http://lists.runrev.com/pipermail/use-livecode/
>
> and search them using this link:
>
> http://www.google.com/advanced_search?q=site:lists.runrev.com
>
>
> Message: 1
> Date: Mon, 20 Jun 2016 22:06:41 -0700 (PDT)
> From: "[-hh]" <[hidden email]>
> To: [hidden email]
> Subject: Re: Get url "file:///..."
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=us-ascii
>
> Assuming you are on a Mac:
> The following should work from 10.4 to 10.12 with LC 5/6/7/8.
>
> on mouseUp
>  put "/Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
> into f
>  put "source" into sOrT --> one of "source", "text", "URL"
>  do iScript(f, sOrT) as applescript
>  put the result into fld 1
> end mouseUp
>
> Using above "text" instead of "source" may save you some work.
> (The LC interpretation as htmltext does the same but somehow 'uncomplete').
>
> function iScript f,x
>  put numToChar(34) into q
>  return "tell application " &  q&"Safari"&q  &cr& \
>        " open POSIX file " &  q&URLdecode(f)&q  &cr& \
>        " set rslt to " & x & " of document 1" &cr& \
>        "end tell"
> end iScript
>
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Get-url-file-tp4705988p4706007.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get url "file:///..."

Klaus major-k
Hi Jim,

> Am 21.06.2016 um 18:02 schrieb Jim Hurley <[hidden email]>:
>
> Hi Klaus,
>
> Yes, that works well. Thank you.
> But it gives me the html source code.

yes, I thought that is what you were after! Not?

> I can live with that, but lots of parsing to get the text
> You seem to suggest I can get the "text" or (?) or html "source"

Which is the same for me, should have written "sourcetext" :-D

> hh's script (below) does that but it is very unstable, crashing frequently
>
> Jim
>
>
> Klaus wrote:
>> Hi Jim,
>>
>> not sure I understand the problem, but this should give you the TEXT/source of that file:
>> ...
>> put url "file:/Users/jimhurley/Library/Mail Downloads/elec_web/precincts/241.htm" into tSource
>> ...

>
> put url "file:/Users/jimhurley/Library/Mail Downloads/elec_web/precincts/241.htm" into msg box
> On Jun 21, 2016, at  3:00 AM, [hidden email] wrote:
>
>>
>> Message: 1
>> Date: Mon, 20 Jun 2016 22:06:41 -0700 (PDT)
>> From: "[-hh]" <[hidden email]>
>> To: [hidden email]
>> Subject: Re: Get url "file:///..."
>> Message-ID: <[hidden email]>
>> Content-Type: text/plain; charset=us-ascii
>>
>> Assuming you are on a Mac:
>> The following should work from 10.4 to 10.12 with LC 5/6/7/8.
>>
>> on mouseUp
>> put "/Users/jimhurley/Library/Mail%20Downloads/elec_web/precincts/241.htm"
>> into f
>> put "source" into sOrT --> one of "source", "text", "URL"
>> do iScript(f, sOrT) as applescript
>> put the result into fld 1
>> end mouseUp
>>
>> Using above "text" instead of "source" may save you some work.
>> (The LC interpretation as htmltext does the same but somehow 'uncomplete').
>>
>> function iScript f,x
>> put numToChar(34) into q
>> return "tell application " &  q&"Safari"&q  &cr& \
>>       " open POSIX file " &  q&URLdecode(f)&q  &cr& \
>>       " set rslt to " & x & " of document 1" &cr& \
>>       "end tell"
>> end iScript

Best

Klaus
--
Klaus Major
http://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
12