lodchjo
Number of posts : 10 Registration date : 2012-01-30
| Subject: Startpage editor Fri Mar 09, 2012 4:10 pm | |
| Hey! I've been using a personalised startpage in my browsers for a long time now, which groups my most used links together into 1 page. I decided to code a startpage editor to make the job easier. See: - Code:
-
dim teller, teller2, teller3, x, a$, b$ label addlink, addlink2, addlink3 label mter,mload,msave,mhelp,mmake,mview top 0,0 left 0,0 height 0,600 width 0,810 show 0 active 0 caption 0,"STARTPAGE EDITOR" color 0,224,223,227 main_menu 1 sub_menu 2 caption 2,"Save" parent 2,1 on_click 2,msave sub_menu 3 caption 3,"Make HTML" parent 3,1 on_click 3,mmake sub_menu 4 caption 4,"View HTML" parent 4,1 on_click 4,mview sub_menu 5 caption 5,"Help" parent 5,1 on_click 5,mhelp sub_menu 6 caption 6,"Exit" parent 6,1 on_click 6,mter rem ----------------------- left container 7 top 7,35 left 7,5 height 7,100 width 7,250 show 7 active 7 edit 100 top 100,30 left 100,5 height 100,21 width 100,101 show 100 active 100 color 100,255,255,255 parent 100,7 edit 101 top 101,30 left 101,115 height 101,21 width 101,126 show 101 active 101 color 101,255,255,255 parent 101,7 text 101,"http://" alpha 11 top 11,10 left 11,7 height 11,13 width 11,27 show 11 active 11 caption 11,"Link/category name" color 11,224,223,227 parent 11,7 alpha 12 top 12,10 left 12,115 height 12,13 width 12,30 show 12 active 12 caption 12,"URL (blank = category)" color 12,224,223,227 parent 12,7 button 13 top 13,65 left 13,5 height 13,22 width 13,100 show 13 active 13 caption 13,"Add Link" parent 13,7 on_click 13, addlink teller=102 teller2=202 teller3=302 rem ----------------------- middle container 14 top 14,35 left 14,270 height 14,100 width 14,250 show 7 active 7 edit 200 top 200,30 left 200,5 height 200,21 width 200,101 show 200 active 200 color 200,255,255,255 parent 200,14 edit 201 top 201,30 left 201,115 height 201,21 width 201,126 show 201 active 201 color 201,255,255,255 parent 201,14 text 201,"http://" alpha 15 top 15,10 left 15,7 height 15,13 width 15,27 show 15 active 15 caption 15,"Link/category name" color 15,224,223,227 parent 15,14 alpha 16 top 16,10 left 16,115 height 16,13 width 16,30 show 16 active 16 caption 16,"URL (blank = category)" color 16,224,223,227 parent 16,14 button 17 top 17,65 left 17,5 height 17,22 width 17,100 show 17 active 17 caption 17,"Add Link" parent 17,14 on_click 17, addlink2 rem ----------------------- right container 18 top 18,35 left 18,535 height 18,100 width 18,250 show 18 active 18 edit 300 top 300,30 left 300,5 height 300,21 width 300,101 show 300 active 300 color 300,255,255,255 parent 300,18 edit 301 top 301,30 left 301,115 height 301,21 width 301,126 show 301 active 301 color 301,255,255,255 parent 301,18 text 301,"http://" alpha 19 top 19,10 left 19,7 height 19,13 width 19,27 show 19 active 19 caption 19,"Link/category name" color 19,224,223,227 parent 19,18 alpha 20 top 20,10 left 20,115 height 20,13 width 20,30 show 20 active 20 caption 20,"URL (blank = category)" color 20,224,223,227 parent 20,18 button 21 top 21,65 left 21,5 height 21,22 width 21,100 show 21 active 21 caption 21,"Add Link" parent 21,18 on_click 21, addlink3 alpha 30 top 30,15 left 30,220 caption 30,"PAGE TITLE: " color 30,224,223,227 edit 31 top 31,10 left 31,300 width 31,200 gosub mload end addlink: top 13,top(13)+25 height 7,height(7)+25 edit teller top teller,30+(teller-100)*12.5 left teller,5 height teller,21 width teller,101 parent teller,7 edit teller+1 top teller+1,30+(teller-100)*12.5 left teller+1,115 height teller+1,21 width teller+1,126 parent teller+1,7 text teller+1, "http://" teller=teller+2 return addlink2: top 17,top(17)+25 height 14,height(14)+25 edit teller2 top teller2,30+(teller2-200)*12.5 left teller2,5 height teller2,21 width teller2,101 parent teller2,14 edit teller2+1 top teller2+1,30+(teller2-200)*12.5 left teller2+1,115 height teller2+1,21 width teller2+1,126 parent teller2+1,14 text teller2+1, "http://" teller2=teller2+2 return addlink3: top 21,top(21)+25 height 18,height(18)+25 edit teller3 top teller3,30+(teller3-300)*12.5 left teller3,5 height teller3,21 width teller3,101 parent teller3,18 edit teller3+1 top teller3+1,30+(teller3-300)*12.5 left teller3+1,115 height teller3+1,21 width teller3+1,126 parent teller3+1,18 text teller3+1, "http://" teller3=teller3+2 return mload: if file_exists ("startpage.txt")=0 then return file_open_read 50,"startpage.txt" file_readln 50,a$:text 31,a$ file_readln 50,teller file_readln 50,teller2 file_readln 50,teller3 for x = 100 to teller-2 step 2 if x>100 top 13,top(13)+25 height 7,height(7)+25 edit x end_if top x,30+(x-100)*12.5 left x,5 height x,21 width x,101 parent x,7 if x>100 then edit x+1 top x+1,30+(x-100)*12.5 left x+1,115 height x+1,21 width x+1,126 parent x+1,7 file_readln 50,a$ text x,a$ file_readln 50,b$ text x+1,b$ next x for x = 200 to teller2-2 step 2 if x>200 top 17,top(17)+25 height 14,height(14)+25 edit x end_if top x,30+(x-200)*12.5 left x,5 height x,21 width x,101 parent x,14 if x>200 then edit x+1 top x+1,30+(x-200)*12.5 left x+1,115 height x+1,21 width x+1,126 parent x+1,14 file_readln 50,a$ text x,a$ file_readln 50,b$ text x+1,b$ next x for x = 300 to teller3-2 step 2 if x>300 top 21,top(21)+25 height 18,height(18)+25 edit x end_if top x,30+(x-300)*12.5 left x,5 height x,21 width x,101 parent x,18 if x>300 then edit x+1 top x+1,30+(x-300)*12.5 left x+1,115 height x+1,21 width x+1,126 parent x+1,18 file_readln 50,a$ text x,a$ file_readln 50,b$ text x+1,b$ next x file_close 50 caption 0,"STARTPAGE EDITOR - file loaded" return msave: file_open_write 50,"startpage.txt" file_writeln 50,text$(31) file_writeln 50,teller file_writeln 50,teller2 file_writeln 50,teller3 for x=100 to teller-2 step 2 a$=text$(x):b$=text$(x+1) file_writeln 50,a$ file_writeln 50,b$ next x for x=200 to teller2-2 step 2 a$=text$(x):b$=text$(x+1) file_writeln 50,a$ file_writeln 50,b$ next x for x=300 to teller3-2 step 2 a$=text$(x):b$=text$(x+1) file_writeln 50,a$ file_writeln 50,b$ next x file_close 50 caption 0,"STARTPAGE EDITOR - file saved at "+time$ return mmake: file_open_write 50,"startpage.html" file_writeln 50,"<HTML>" file_writeln 50,"<HEAD>" file_writeln 50,"<title>"+text$(31)+"</title>" file_writeln 50,"<style type="+chr$(34)+"text/css"+chr$(34)+">" file_writeln 50,"table {border: 1px; valign:top; border: outset 5pt; padding: 10px;}" file_writeln 50,"td {vertical-align: top; width:260px; font-size: 14px; padding: 5px 20px; line-height:160%;}" file_writeln 50,"hr {color:#D4D4D4;}" file_writeln 50,"h1 {padding: 0px 0px; line-height:50%; color: #339933;}" file_writeln 50,"h3 {padding: 0px 0px; line-height:50%; text-align: center; font-weight: bold;}" file_writeln 50,"a:link {color: #339933; text-decoration: none; font-weight: bold; font-size: 100%; text-align: center; padding: 5px;}" file_writeln 50,"a:visited { text-decoration: none; color: #339933; font-weight: bold; font-size: 100%; text-align: center; padding: 5px;}" file_writeln 50,"a:active { text-decoration: none; color: #339933; font-weight: bold; font-size: 100%; text-align: center; padding: 5px;}" file_writeln 50,"a:hover { color: #993399; text-decoration: underline; font-weight: bold; font-size: 100%; text-align: center; padding: 0px;}" file_writeln 50,"</style>" file_writeln 50,"</HEAD>" file_writeln 50,"<BODY bgcolor="+chr$(34)+"#D4D4D4"+chr$(34)+">" file_writeln 50,"<CENTER>" file_writeln 50,"<TABLE bgcolor="+chr$(34)+"#E8E8E8"+chr$(34)+">" file_writeln 50,"<TR>" file_writeln 50,"<TD colspan="+chr$(34)+"3"+chr$(34)+"><CENTER>" file_writeln 50,"<H1>"+text$(31)+"</H1></CENTER>" file_writeln 50,"</TD>" file_writeln 50,"</TR><TR>" file_writeln 50,"<TD>" for x=100 to teller-2 step 2 if text$(x+1)="http://" file_writeln 50,"<br><hr><h3>"+text$(x)+"</h3><hr>" else file_writeln 50, "<a href="+chr$(34)+text$(x+1)+chr$(34)+">"+text$(x)+"</a><br />" end_if next x file_writeln 50,"</TD>" file_writeln 50,"<TD>" for x=200 to teller2-2 step 2 if text$(x+1)="http://" file_writeln 50,"<br><hr><h3>"+text$(x)+"</h3><hr>" else file_writeln 50, "<a href="+chr$(34)+text$(x+1)+chr$(34)+">"+text$(x)+"</a><br />" end_if next x file_writeln 50,"</TD>" file_writeln 50,"<TD>" for x=300 to teller3-2 step 2 if text$(x+1)="http://" file_writeln 50,"<br><hr><h3>"+text$(x)+"</h3><hr>" else file_writeln 50, "<a href="+chr$(34)+text$(x+1)+chr$(34)+">"+text$(x)+"</a><br />" end_if next x file_writeln 50,"</TD>" file_writeln 50,"</TABLE>" file_writeln 50,"</BODY>" file_writeln 50,"</HTML>" file_close 50 caption 0,"STARTPAGE EDITOR - startpage created! " return mview: if file_exists ("startpage.html")=1 then execute "startpage.html" return mhelp: message "- The startpage is opened automatically, but there is no automatic save on exit!"+chr$(13)+ "- Add links in the different text fields. If the URL text field is not filled out (leaving only ''http://'') it will create a category instead."+chr$(13)+"- There is a limit of 50 links/categories for each column."+chr$(13)+chr$(13)+"Created by Lodchjo using Panoramic." return mter: terminate - The startpage is created in the program folder - The startpage is opened automatically, but there is no automatic save on exit! - Add links in the different text fields. If the URL text field is not filled out (leaving only ''http://'') it will create a category instead. - There is a limit of 50 links/categories for each column I hope it's useful! Lode PS: I just realised it's not possible to insert a new link between existing links; maybe i'll make an update for this later on. Edits might be done in the txt-file (containing all the data), or one can move the links one by one in the editor window. | |
|