Page 1 of 1

Changing/updating a Html file.

Posted: Wed Feb 10, 2016 12:51 pm
by Fitz
I am working on a stack kindly provided in another post, some time ago.

The stack updates and launches a HTML file. I cannot fathom how to change that HTML file to my own file or edit the original file with my own code. I have tried changing the name of the HTML file to match that of the one Klaus used, however the HTML file always reverts back to the original code or creates a new HTML.

Code: Select all

on googleMap atraiter
   put the uGoogleMap of this stack into lamorce
   put empty into lesData1 
   put empty into lesData2
   set itemdelimiter to tab
   repeat with i = 1 to the number of lines of aTraiter
      
      put item 1 of line i of atraiter into leNom
      put item 2 of line i of atraiter into lesCoordonnees
      
      put "var latlngPos"&i&" = new google.maps.LatLng("&lesCoordonnees&");"&cr after lesData1
      
      put "var marker = new google.maps.Marker({"&cr after lesData2
      put "position: latlngPos"&i&","&cr after lesData2
      put " map: map,"&cr after lesData2
      put "title: "&quote&leNom&quote&"});"&cr after lesData2
      
   end repeat
   
   if the number of lines of aTraiter > 5 then
      replace "[DATAZOOM]" with "zoom: 6," in lamorce
   else
      replace "[DATAZOOM]" with "zoom: 10," in lamorce
   end if
   replace "[DATA1]" with lesData1 in lamorce
   replace "[DATA2]" with lesData2 in lamorce
   
   put the effective filename of this stack into tPath
   set the itemDelimiter to slash
   delete last item of tPath
   put "file:"&tPath&"/carte.html" into abc
   put lamorce into url abc
   launch url "file:"&tPath&"/carte.html"
end googleMap
Unfortunately i cannot upload the file, however i have put the code used above.

Any help would be greatly appreciated.

Re: Changing/updating a Html file.

Posted: Wed Feb 10, 2016 1:06 pm
by Klaus
Bonjour Fitz,
Fitz wrote:I am working on a stack kindly provided by Klaus in another post, some time ago.
NEVER! I am sure I have a good alibi! :D

Sorry, I am not sure what your problem is?
Is this happening in a standalone?
If yes, then you may not write in the current directory where the standalone resides.

If not, I need more info.


Best

Klaus

Re: Changing/updating a Html file.

Posted: Wed Feb 10, 2016 2:35 pm
by Fitz
Hi Klaus,
Thank you for replying.

No this is happening in Livecode, The stack you built, is great, it really helped with my learning of livecode. :D

The stack in question Updates a HTML file "carte" i need the stack to /update my Html file "carte2".

If i change,

Code: Select all

   put "file:"&tPath&"/carte2.html" into abc
   put lamorce into url abc
   launch url "file:"&tPath&"/carte2.html"

This simply replaces the html code of carte2 ( the new Html file) with the code from carte1 ( the old Html file) . I have put both html filed in the same folder

Your help is greatly apreciated.

Re: Changing/updating a Html file.

Posted: Wed Feb 10, 2016 2:40 pm
by Klaus
Hi Fitz,
Fitz wrote:If i change,

Code: Select all

   put "file:"&tPath&"/carte2.html" into abc
   put lamorce into url abc
   launch url "file:"&tPath&"/carte2.html"

This simply replaces the html code of carte2 ( the new Html file) with the code from carte1 ( the old Html file) . I have put both html filed in the same folder
Hm, if "lamorce" does NOT contain the contents of the file "carte1.html" (and looking at your script it does NOT), then I don't understand what might happen here!?
What am I overlooking? Sorry, don't get it...


Best

Klaus

Re: Changing/updating a Html file.

Posted: Wed Feb 10, 2016 2:57 pm
by Fitz
Yes it has me a bit stumped to, here is the link for the original stack http://forums.runrev.com/download/file.php?id=3548

Do you think it has something to do with

Code: Select all

 the uGoogleMap of this stack into lamorce


Thanks

Re: Changing/updating a Html file.

Posted: Wed Feb 10, 2016 3:09 pm
by Klaus
Hm, since I never worked with GOOGLE maps in Livecode, I doubt that this is one of my stacks!? :D
Do you have a link to that forum thread?

Anyway, what is in "the uGoogleMap of this stack"?
I thought you put it into that custom property?

If yes, then you should be able to answer that question.
If not, you should check that custom property a soon as possible! 8)

Re: Changing/updating a Html file.

Posted: Wed Feb 10, 2016 3:27 pm
by Fitz
Apologies, i thought that it was your stack ( i have been reading so many of your posts, on my quest to learn livecode), the link to that forum thread is

Code: Select all

http://forums.livecode.com/viewtopic.php?f=7&t=13547
No i have not stumbled across custom properties as yet, i did not no i could use HTML etc. within a custom property, this is amazing.

Thank you so much for your help. I really appreciate it.

Re: Changing/updating a Html file.

Posted: Wed Feb 10, 2016 3:50 pm
by Klaus
Hi Fitz,

okie dokie :D

Yes, custom properties are very useful and you can store EVERYTHING (text, binary etc.) in them, just like in variables.
See a custom property like a variable that is "tied" to a specific object that also gets saved with the stack!

You can also put files in a CP and later save it back to disk again, see this thread:
http://forums.livecode.com/viewtopic.php?f=7&t=26362


Best

Klaus

Re: Changing/updating a Html file.

Posted: Mon Mar 07, 2016 3:02 pm
by okk
Hi,
by coincidence I was playing around with the same stack to embed google maps into an application. The custom property uGoogleMap of the discussed stack contains a HTML/Javascript template. In the beginning of the script the variable lamorce is set to the content stored in the custom property uGoogleMap:

Code: Select all

put the uGoogleMap2 of this stack into lamorce
You can inspect and change the content of this custom property uGoogleMap in the Stack Inspector under the Custom Property tab. The script in the discussed stack then replaces some placeholders in the HTML template with actual coordinates for the markers etc. , safes it as an HTML file called "carte.html", and then launches this file in a browser.

Since I wanted to play around with parameters of the HTML/javascript template I copied the content of the custom property uGoogleMap into a textfield "code" on my stack and changed the initial code like this:

Code: Select all

put field "code" of card "map" into lamorce
Now you can change the HTML/javascript directly in a textfield and see the effect it has on the google maps.

Best
Oliver