Getting URL to Work in specialFolderDocuments

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

Getting URL to Work in specialFolderDocuments

Ralph DiMola via use-livecode
on dataServerStack
   local tHttpsServerRoot,tLocalDocumentsStories
   put "https://dev.himalayanacademy.com/media/stories/" --into tHttpsServerRoot
   put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into tLocalDocumentsStories
   put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
end dataServerStack 

it goes badly to documents folder,

?

BR

_______________________________________________
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: Getting URL to Work in specialFolderDocuments

Ralph DiMola via use-livecode
on dataServerStack
   local tHttpsServerRoot,tLocalDocumentsStories
   put "https://dev.himalayanacademy.com/media/stories/" --into tHttpsServerRoot
   put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into tLocalDocumentsStories
   put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
end dataServerStack

it goes badly to documents folder,

on dataServerStack
   local tHttpsServerRoot,tLocalDocumentsStories
   put "https://dev.himalayanacademy.com/media/stories/" into tHttpsServerRoot
   put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into tLocalDocumentsStories
   put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
end dataServerStack

it goes badly to documents folder,

?
put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
 
Compile error line 119 (Handler: bad command) near "&", char 84


BR


    _______________________________________________
    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: Getting URL to Work in specialFolderDocuments

Ralph DiMola via use-livecode
You are putting a file from a url into a variable called tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode”. You should probably have a variable with the full path to the file:

put tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode” into tFilePath

Then put the file from the url into the location using the URL command:

put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode”) into URL (“binfile:” & tFilePath

The problem with trying to put all the fiddlybits into one line is that you cannot tell where things are going wrong. You sacrifice readability and ease of debugging for compact code, and with Livecode, do we really need compact code?

Bob S

>

> On Oct 2, 2020, at 2:59 PM, Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> on dataServerStack
>   local tHttpsServerRoot,tLocalDocumentsStories
>   put "https://dev.himalayanacademy.com/media/stories/" --into tHttpsServerRoot
>   put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into tLocalDocumentsStories
>   put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
> end dataServerStack
>
> it goes badly to documents folder,
>
> on dataServerStack
>   local tHttpsServerRoot,tLocalDocumentsStories
>   put "https://dev.himalayanacademy.com/media/stories/" into tHttpsServerRoot
>   put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into tLocalDocumentsStories
>   put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
> end dataServerStack
>
> it goes badly to documents folder,
>
> ?
> put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
>
> Compile error line 119 (Handler: bad command) near "&", char 84
>
>
> BR
>
>
>    _______________________________________________
>    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: Getting URL to Work in specialFolderDocuments

Ralph DiMola via use-livecode
In reply to this post by Ralph DiMola via use-livecode
 Hi

I get a headache looking at concatenations like this.  I don't use them
unless I'm constructing a simple string.

  put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle
& ".livecode"

It will be a cold day in hell when I don't use Merge() to construct
non-simple strings.

*put* "blurb1" into sStoryTitle

*put* "https://dev.himalayanacademy.com/media/stories/" into
tHttpsServerRoot

*put* specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into
tLocalDocumentsStories

*if* char -1 of tHttpsServerRoot is "/" *then* *delete* char -1 of
tHttpsServerRoot ## deleting "/" to make merge() template clearer

*if* char -1 of tLocalDocumentsStories is "/" *then* *delete* char -1 of
 tLocalDocumentsStories

*put* merge(          "[[tHttpsServerRoot
]]/[[sStoryTitle]]/[[sStoryTitle]].livecode" ) into tSourceURL

*put* merge( "binfile:[[tLocalDocumentsStories]]/[[
sStoryTitle]]/[[sStoryTitle]].livecode" ) into tDestURL
put URL  tSourceURL into URL tDestURL


On each of the above lines one can use breakpoints to check the values of
the variables and at the last line check that the URLs to use are correct.

Merge() will ignore spaces within [[]] and outside of the quotes around the
template string, so one can line up placeholders to check that all the
template parts match visually.

HTH
Bernard

On Fri, Oct 2, 2020 at 11:00 PM Sannyasin Brahmanathaswami via use-livecode
<[hidden email]> wrote:

> on dataServerStack
>    local tHttpsServerRoot,tLocalDocumentsStories
>    put "https://dev.himalayanacademy.com/media/stories/" --into
> tHttpsServerRoot
>    put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into
> tLocalDocumentsStories
>    put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
> ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle
> & ".livecode"
> end dataServerStack
>
> it goes badly to documents folder,
>
> on dataServerStack
>    local tHttpsServerRoot,tLocalDocumentsStories
>    put "https://dev.himalayanacademy.com/media/stories/" into
> tHttpsServerRoot
>    put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into
> tLocalDocumentsStories
>    put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
> ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle
> & ".livecode"
> end dataServerStack
>
> it goes badly to documents folder,
>
> ?
> put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode")
> into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
>
> Compile error line 119 (Handler: bad command) near "&", char 84
>
>
> BR
>
>
>     _______________________________________________
>     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: Getting URL to Work in specialFolderDocuments

Ralph DiMola via use-livecode
In reply to this post by Ralph DiMola via use-livecode
Aloha,

The last "put" command is wrong. This one:

>   put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle
& ".livecode"

It should have been:

   put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
".livecode") into ("binfile:" & tLocalDocumentsStories & sStoryTitle & "/"
& sStoryTitle & ".livecode")

Also, there is a strange comment before the word "into" when you're setting
tHttpsServerRoot.

Best
A

On Fri, 2 Oct 2020 at 19:01, Sannyasin Brahmanathaswami via use-livecode <
[hidden email]> wrote:

> on dataServerStack
>    local tHttpsServerRoot,tLocalDocumentsStories
>    put "https://dev.himalayanacademy.com/media/stories/" --into
> tHttpsServerRoot
>    put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into
> tLocalDocumentsStories
>    put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
> ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle
> & ".livecode"
> end dataServerStack 
>
> it goes badly to documents folder,
>
> ?
>
> BR
>
> _______________________________________________
> 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
>


--
https://www.andregarzia.com <http://www.andregarzia.com>
Want to support me? Buy me a coffee at https://ko-fi.com/andregarzia
_______________________________________________
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