Want to Make an Index for My Web Page

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
trailboss
Posts: 121
Joined: Sat Dec 13, 2008 4:55 pm

Want to Make an Index for My Web Page

Post by trailboss » Thu Oct 23, 2014 5:51 am

I have a web page with lots of stuff in it. I want an index of all the files in it so you can see at a glance what's in it and go to pages fast.

So, I'd like to have RunRev look into a folder named, say: allmywebpagefiles and import a list of all the file names.

Then I could alphabetize them and stick them onto an html document so I could navigate in a new way by clicking:

adobebuilding.html
dogs.html
houseondrurylane.html
myguitar.html
yosemitepark.html
zamoramexicotrip.html

Someone showed me how a long time ago, but I can't remember.

Thanks,
Tom

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Want to Make an Index for My Web Page

Post by FourthWorld » Thu Oct 23, 2014 6:42 am

See the"files" function in the dictionary.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trailboss
Posts: 121
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss » Thu Oct 23, 2014 6:46 am

Ah, I see this:

put the files into field "Current Files"
repeat with x = 1 to the number of lines of the detailed files
put the files & the folders into diskContents[the defaultFolder]

But how to I point it to the folder "allmysitefiles" or something.

I'm not very good at this. Has to do with the defaultFolder I should think.

Tom

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Want to Make an Index for My Web Page

Post by Klaus » Thu Oct 23, 2014 11:50 am

Hi Tom,

...
set the folder to "path/to/your/folder/allmysitefiles"
put the files into tFiles
...
"folder" is a shortcut for "defaultfolder" :D


Best

Klaus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Want to Make an Index for My Web Page

Post by FourthWorld » Thu Oct 23, 2014 2:49 pm

Klaus' post is very helpful. The only thing I would add is that you can let the user select a folder with the "answer folder" command.

And if you're dealing with folders at fixed locations, the specialFolderPath function may help for locating a good many specific folders on each OS.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trailboss
Posts: 121
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss » Thu Oct 23, 2014 4:22 pm

It works! I just wrote:

on mouseup
set the folder to "/users/tomcole/Backup Google Drive/more web Material/"
put the files into tFiles
put tfiles into cd fld "filelist"
end mouseup

Now I can have a huge list and you can search it and click to extract any specific sheep from the entire herd of sheep and goats and go to it at once.

Thank you very much!

Tom

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Want to Make an Index for My Web Page

Post by Simon » Thu Oct 23, 2014 7:43 pm

Hi Tom,
I'm glad to hear it's all working for you but wanted to give you a tip that may save you some headaches in the future.
Watch out for spaces in your paths, "Backup Google Drive/more web Material", urlEncode will fix it for you.
Nothing for you to do now but one day....

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

trailboss
Posts: 121
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss » Thu Oct 23, 2014 7:48 pm

Thanks Simon.

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Want to Make an Index for My Web Page

Post by Klaus » Thu Oct 23, 2014 9:22 pm

HI Tom,

you can save some typing by overcoming old HC habits:
HC: put tfiles into cd fld "filelist"
LC: put tfiles into fld "filelist"

Spot the difference :D


Best

Klaus

trailboss
Posts: 121
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss » Fri Oct 24, 2014 4:33 pm

How did you know I was so old? :D It's nice to know that I belong to an exclusive group that knows abbreviations like HC.

Back to topic:
However, answer fld "filelist" gets me nothing.
Neither does answer bg fld "filelist"
But answer cd fld "filelist" seems to work.

Long live Bill Atkinson!

Tom

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Want to Make an Index for My Web Page

Post by Klaus » Fri Oct 24, 2014 5:03 pm

Hm, just made a test with LC 6.7 and -> answer fld "Field1"
did actually work on OS X 10.10!

What version are you using?

trailboss
Posts: 121
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss » Fri Oct 24, 2014 11:27 pm

Oh, I have the new stuff, but I'm still using Studio 2.8.1 for many things.

Post Reply

Return to “Talking LiveCode”