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: 124
Joined: Sat Dec 13, 2008 4:55 pm

Want to Make an Index for My Web Page

Post by trailboss »

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: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Want to Make an Index for My Web Page

Post by FourthWorld »

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: 124
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss »

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: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Want to Make an Index for My Web Page

Post by Klaus »

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: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Want to Make an Index for My Web Page

Post by FourthWorld »

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: 124
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss »

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

Re: Want to Make an Index for My Web Page

Post by Simon »

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: 124
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss »

Thanks Simon.
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Want to Make an Index for My Web Page

Post by Klaus »

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: 124
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss »

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: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Want to Make an Index for My Web Page

Post by Klaus »

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: 124
Joined: Sat Dec 13, 2008 4:55 pm

Re: Want to Make an Index for My Web Page

Post by trailboss »

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