Generating folder/files

freeBASIC source code examples by FbCadcam staff and interns

Moderators: yajra1219, Jayem, kitty_webb, Ywsp, joanCruz03, shela

Post Reply
User avatar
Ichibane
Posts: 50
Joined: Tue Oct 16, 2018 4:37 am

Generating folder/files

Post by Ichibane » Sat Dec 07, 2019 5:52 pm

Code: Select all

Declare Function FolderExists(Byref name_folder As String) As Integer

Dim as string FName
Dim as string MName
Dim as string LName
Dim as string Div
Dim as string Rate
Dim as string SRank
Dim as string SQual
Dim as string Smm
Dim as string Syy
Dim as string ERank
Dim as string EQual
Dim as string Emm
Dim as string Eyy

Input "enter first name "; FName
Input "enter middle name ";MName
Input "enter last name "; LName
Input "enter division "; Div
Input "enter rate "; Rate
Input "enter starting rank "; SRank
Input "starting SU or SS "; SQual
Input "starting month "; Smm
Input "starting year "; Syy
Input "ending rank ";ERank
Input "ending qual ";EQual
Input "ending month "; Emm
Input "ending year ";Eyy

Dim as string folder
folder = LName+"_"+FName+"_"+Syy

If Not FolderExists(folder) Then MkDir(folder)

Dim as string filename
filename = folder+"index.html"

Open filename for output as #1
Print #1, "this is a test"
Close #1

Dim as string forumurl, F, T
Input "enter forum F="; F
Input "enter forum T="; T
forumurl="https://­usschicagossn721.net/­forum/viewtopic.php?f="+F+"&t="+T
Sleep

Function FolderExists(Byref name_folder As String) As Integer
  Dim current_folder As String = Curdir
  Function = Not Chdir(name_folder)
  Chdir(current_folder)
End Function

owen
Site Admin
Posts: 654
Joined: Thu Apr 13, 2017 12:14 pm

Re: Generating folder/files

Post by owen » Sat Dec 07, 2019 6:38 pm

Ok continue to post the rest of your code in here so I can help u make this program

owen
Site Admin
Posts: 654
Joined: Thu Apr 13, 2017 12:14 pm

Re: Generating folder/files

Post by owen » Sat Dec 07, 2019 7:57 pm

simple way

Code: Select all

'create a folder and write a file in it
dim as string foldername="test"
dim as string filename="test.txt"
dim as string folderandfile=foldername+"\"+filename
mkdir(foldername)
open folderandfile for output as #1
print #1, "asdf"
close #1
'test to see if it worked
dim as string s
open folderandfile for input as #1
input #1, s
close #1
print s
sleep


owen
Site Admin
Posts: 654
Joined: Thu Apr 13, 2017 12:14 pm

Re: Generating folder/files

Post by owen » Sat Dec 07, 2019 8:20 pm

here is an example of how easy it is to make this program

Code: Select all

Dim as string FName
Dim as string MName
Dim as string LName
Dim as string Div
Dim as string Rate
Dim as string SRank
Dim as string SQual
Dim as string Smm
Dim as string Syy
Dim as string ERank
Dim as string EQual
Dim as string Emm
Dim as string Eyy
Dim as string forumurl, F, T
Dim as string folder
Dim as string filename

Input "enter first name "; FName
Input "enter middle name ";MName
Input "enter last name "; LName
Input "enter division "; Div
Input "enter rate "; Rate
Input "enter starting rank "; SRank
Input "starting SU or SS "; SQual
Input "starting month "; Smm
Input "starting year "; Syy
Input "ending rank ";ERank
Input "ending qual ";EQual
Input "ending month "; Emm
Input "ending year ";Eyy
Input "enter forum F="; F
Input "enter forum T="; T
forumurl="https://usschicagossn721.net/forum/viewtopic.php?f="+F+"&t="+T

folder = LName+"_"+FName+"_"+Syy
mkdir(folder)
filename = folder+"\index.html"
Open filename for output as #1
'-------------------------------
'insert code here to create html
'-------------------------------
Close #1

Sleep


owen
Site Admin
Posts: 654
Joined: Thu Apr 13, 2017 12:14 pm

Re: Generating folder/files

Post by owen » Sat Dec 07, 2019 8:43 pm

and here's an example with the html in it

Code: Select all

Dim as string FName
Dim as string MName
Dim as string LName
Dim as string Div
Dim as string Rate
Dim as string SRank
Dim as string SQual
Dim as string Smm
Dim as string Syy
Dim as string ERank
Dim as string EQual
Dim as string Emm
Dim as string Eyy
Dim as string forumurl, F, T
Dim as string folder
Dim as string filename

Input "enter first name "; FName
Input "enter middle name ";MName
Input "enter last name "; LName
Input "enter division "; Div
Input "enter rate "; Rate
Input "enter starting rank "; SRank
Input "starting SU or SS "; SQual
Input "starting month "; Smm
Input "starting year "; Syy
Input "ending rank ";ERank
Input "ending qual ";EQual
Input "ending month "; Emm
Input "ending year ";Eyy
Input "enter forum F="; F
Input "enter forum T="; T
forumurl="https://usschicagossn721.net/forum/viewtopic.php?f="+F+"&t="+T

folder = LName+"_"+FName+"_"+Syy

mkdir(folder)

filename = folder+"\index.html"

Open filename for output as #1
'-------------------------------
'insert code here to create html


print #1, "<!DOCTYPE html>"
print #1, "<html>"
print #1, "<head>"
print #1, "	<meta name="; chr(34); "viewport"; chr(34); " content="; chr(34); "width=device-width, initial-scale=1.0"; chr(34); ">"
print #1, "	<title>About</title>"
print #1, "	<style>"
print #1, "		.textalign {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: grey;"
print #1, "			font-family: century gothic;"
print #1, "			text-align: center;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.content {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: #383939;"
print #1, "			font-family: century gothic;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.highlight {"
print #1, "			color: #6FFFD8;"
print #1, "		}"
print #1, "		.pics{"
print #1, "			border-radius: 20px;"
print #1, "			max-width: 100%;"
print #1, "			height: auto;"
print #1, "		}"
print #1, "		.quicklinks a{"
print #1, "			color: #6FFFD8;"
print #1, "			font-weight: bold;"
print #1, "			text-decoration: none;"
print #1, "		}"
print #1, "		.quicklinks a:hover{"
print #1, "			color: white;"
print #1, "			text-decoration: underline;"
print #1, "		}"
print #1, "	</style>"
print #1, "</head>"
print #1, "<body>"
print #1, "	<div class="; chr(34); "textalign quicklinks"; chr(34); " id="; chr(34); "quick_links"; chr(34); " style="; chr(34); "padding: 5px!important;"; chr(34); ">"
print #1, "		<center>"
print #1, "			<br>"
print #1, "			<a href="; chr(34); "https://usschicagossn721.org"; chr(34); ">"
print #1, "			<img src="; chr(34); "../pics/usslogo.png"; chr(34); " alt="; chr(34); "uss1"; chr(34); " width="; chr(34); "100"; chr(34); " height="; chr(34); "100"; chr(34); " align="; chr(34); "center"; chr(34); " class="; chr(34); "pics"; chr(34); ">"
print #1, "			</a>"
print #1, "			<h1>USS Chicago (SSN-721)</h1>"
print #1, "			<p style="; chr(34); "font-size: 15px;"; chr(34); ">"
print #1, "				<a href="; chr(34); "../index.html#CO"; chr(34); ">CO</a> | "
print #1, "				<a href="; chr(34); "../index.html#XO"; chr(34); ">XO</a> | "
print #1, "				<a href="; chr(34); "../index.html#NAV"; chr(34); ">NAV</a> | "
print #1, "				<a href="; chr(34); "../index.html#WEPS"; chr(34); ">WEPS</a> | "
print #1, "				<a href="; chr(34); "../index.html#ENG"; chr(34); ">ENG</a> | "
print #1, "				<a href="; chr(34); "../index.html#SUPPO"; chr(34); ">SUPPO</a> | "
print #1, "				<a href="; chr(34); "../index.html#JO's"; chr(34); ">JO's</a> | "
print #1, "				<a href="; chr(34); "../index.html#COB"; chr(34); ">COB</a> | "
print #1, "				<a href="; chr(34); "../index.html#HM"; chr(34); ">HM</a> | "
print #1, "				<a href="; chr(34); "../index.html#YN"; chr(34); ">YN</a> | "
print #1, "				<a href="; chr(34); "../index.html#RM_ETR"; chr(34); ">RM&ETR</a> | "
print #1, "				<a href="; chr(34); "../index.html#QM"; chr(34); ">QM</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETV"; chr(34); ">ET&ETV</a> | "
print #1, "				<a href="; chr(34); "../index.html#IC"; chr(34); ">IC</a> | "
print #1, "				<a href="; chr(34); "../index.html#ITS"; chr(34); ">ITS</a> | "
print #1, "				<a href="; chr(34); "../index.html#FTG"; chr(34); ">FTG</a> | "
print #1, "				<a href="; chr(34); "../index.html#TM"; chr(34); ">TM&MMW</a> | "
print #1, "				<a href="; chr(34); "../index.html#STS"; chr(34); ">STS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMA"; chr(34); ">MM&MMA</a> | "
print #1, "				<a href="; chr(34); "../index.html#DD"; chr(34); ">DD</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMN"; chr(34); ">MM&MMN</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETN"; chr(34); ">ET&ETN</a> | "
print #1, "				<a href="; chr(34); "../index.html#EM"; chr(34); ">EM</a> | "
print #1, "				<a href="; chr(34); "../index.html#SK_LS"; chr(34); ">SK&LS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MS_CS"; chr(34); ">MS&CS</a>"
print #1, "			</p>"
print #1, "		</center>"
print #1, "	</div>"
print #1, "	<div class="; chr(34); "textalign"; chr(34); ">"
print #1, "		<h2>Name</h2>"
print #1, "		<h3>Division</h3>"
print #1, "		<h3>Rate Rank Dates</h3>"
print #1, "		<a href="; chr(34); "https://usschicagossn721.net/forum/"; chr(34); " class="; chr(34); "highlight"; chr(34); ">Forum</a>"
print #1, "	</div> "
print #1, "	<div class="; chr(34); "content"; chr(34); ">"
print #1, "		Enter Page Content Here"
print #1, "	</div>"
print #1, "</body>"
print #1, "</html>"




'-------------------------------
Close #1

Sleep



owen
Site Admin
Posts: 654
Joined: Thu Apr 13, 2017 12:14 pm

Re: Generating folder/files

Post by owen » Sat Dec 07, 2019 8:44 pm

notice in the code above how i use chr(34)? that prints a quotation mark

now all u got to do is include the variables in the html section of code where appropriate

User avatar
Ichibane
Posts: 50
Joined: Tue Oct 16, 2018 4:37 am

Re: Generating folder/files

Post by Ichibane » Sun Dec 08, 2019 4:25 am

Here is the latest codes regarding the last codes that you've posted

Code: Select all

Dim as string FName
Dim as string MName
Dim as string LName
Dim as string Div
Dim as string Rate
Dim as string SRank
Dim as string SQual
Dim as string Smm
Dim as string Syy
Dim as string ERank
Dim as string EQual
Dim as string Emm
Dim as string Eyy
Dim as string forumurl, T
Dim as string folder
Dim as string filename

Input "enter first name "; FName
Input "enter middle name ";MName
Input "enter last name "; LName
Input "enter division "; Div
Input "enter rate "; Rate
Input "enter starting rank "; SRank
Input "starting SU or SS "; SQual
Input "starting month "; Smm
Input "starting year "; Syy
Input "ending rank ";ERank
Input "ending qual ";EQual
Input "ending month "; Emm
Input "ending year ";Eyy
Input "enter forum T="; T

forumurl="https://usschicagossn721.net/forum/viewtopic.php?f=17&t="+T

folder = LName+"_"+FName+"_"+Syy

mkdir(folder)

filename = folder+"\index.html"

Open filename for output as #1
'-------------------------------
'insert code here to create html


print #1, "<!DOCTYPE html>"
print #1, "<html>"
print #1, "<head>"
print #1, "	<meta name="; chr(34); "viewport"; chr(34); " content="; chr(34); "width=device-width, initial-scale=1.0"; chr(34); ">"
print #1, "	<title>About"; " " + FName + " " + LName; "</title>"
print #1, "	<style>"
print #1, "		.textalign {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: grey;"
print #1, "			font-family: century gothic;"
print #1, "			text-align: center;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.content {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: #383939;"
print #1, "			font-family: century gothic;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.highlight {"
print #1, "			color: #6FFFD8;"
print #1, "		}"
print #1, "		.pics{"
print #1, "			border-radius: 20px;"
print #1, "			max-width: 100%;"
print #1, "			height: auto;"
print #1, "		}"
print #1, "		.quicklinks a{"
print #1, "			color: #6FFFD8;"
print #1, "			font-weight: bold;"
print #1, "			text-decoration: none;"
print #1, "		}"
print #1, "		.quicklinks a:hover{"
print #1, "			color: white;"
print #1, "			text-decoration: underline;"
print #1, "		}"
print #1, "	</style>"
print #1, "</head>"
print #1, "<body>"
print #1, "	<div class="; chr(34); "textalign quicklinks"; chr(34); " id="; chr(34); "quick_links"; chr(34); " style="; chr(34); "padding: 5px!important;"; chr(34); ">"
print #1, "		<center>"
print #1, "			<br>"
print #1, "			<a href="; chr(34); "https://usschicagossn721.org"; chr(34); ">"
print #1, "			<img src="; chr(34); "../pics/usslogo.png"; chr(34); " alt="; chr(34); "uss1"; chr(34); " width="; chr(34); "100"; chr(34); " height="; chr(34); "100"; chr(34); " align="; chr(34); "center"; chr(34); " class="; chr(34); "pics"; chr(34); ">"
print #1, "			</a>"
print #1, "			<h1>USS Chicago (SSN-721)</h1>"
print #1, "			<p style="; chr(34); "font-size: 15px;"; chr(34); ">"
print #1, "				<a href="; chr(34); "../index.html#CO"; chr(34); ">CO</a> | "
print #1, "				<a href="; chr(34); "../index.html#XO"; chr(34); ">XO</a> | "
print #1, "				<a href="; chr(34); "../index.html#NAV"; chr(34); ">NAV</a> | "
print #1, "				<a href="; chr(34); "../index.html#WEPS"; chr(34); ">WEPS</a> | "
print #1, "				<a href="; chr(34); "../index.html#ENG"; chr(34); ">ENG</a> | "
print #1, "				<a href="; chr(34); "../index.html#SUPPO"; chr(34); ">SUPPO</a> | "
print #1, "				<a href="; chr(34); "../index.html#JO's"; chr(34); ">JO's</a> | "
print #1, "				<a href="; chr(34); "../index.html#COB"; chr(34); ">COB</a> | "
print #1, "				<a href="; chr(34); "../index.html#HM"; chr(34); ">HM</a> | "
print #1, "				<a href="; chr(34); "../index.html#YN"; chr(34); ">YN</a> | "
print #1, "				<a href="; chr(34); "../index.html#RM_ETR"; chr(34); ">RM&ETR</a> | "
print #1, "				<a href="; chr(34); "../index.html#QM"; chr(34); ">QM</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETV"; chr(34); ">ET&ETV</a> | "
print #1, "				<a href="; chr(34); "../index.html#IC"; chr(34); ">IC</a> | "
print #1, "				<a href="; chr(34); "../index.html#ITS"; chr(34); ">ITS</a> | "
print #1, "				<a href="; chr(34); "../index.html#FTG"; chr(34); ">FTG</a> | "
print #1, "				<a href="; chr(34); "../index.html#TM"; chr(34); ">TM&MMW</a> | "
print #1, "				<a href="; chr(34); "../index.html#STS"; chr(34); ">STS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMA"; chr(34); ">MM&MMA</a> | "
print #1, "				<a href="; chr(34); "../index.html#DD"; chr(34); ">DD</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMN"; chr(34); ">MM&MMN</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETN"; chr(34); ">ET&ETN</a> | "
print #1, "				<a href="; chr(34); "../index.html#EM"; chr(34); ">EM</a> | "
print #1, "				<a href="; chr(34); "../index.html#SK_LS"; chr(34); ">SK&LS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MS_CS"; chr(34); ">MS&CS</a>"
print #1, "			</p>"
print #1, "		</center>"
print #1, "	</div>"
print #1, "	<div class="; chr(34); "textalign"; chr(34); ">"
print #1, "		<h2>";FName + " " + MName + " " + LName  ;"</h2>"
print #1, "		<h3>";Div;"</h3>"
print #1, "		<h3>";Rate + SRank;"(";SQual;") ";Smm;"/";Syy;" to ";Rate + ERank;"(";EQual;") ";Emm;"/";Eyy;"</h3>"
Print #1, "		<a href="; chr(34) + forumurl + chr(34); " class="; chr(34); "highlight"; chr(34); ">Forum</a>"
print #1, "	</div> "
print #1, "	<div class="; chr(34); "content"; chr(34); ">"
print #1, "		Enter Page Content Here"
print #1, "	</div>"
print #1, "</body>"
print #1, "</html>"




'-------------------------------
Close #1

Sleep

owen
Site Admin
Posts: 654
Joined: Thu Apr 13, 2017 12:14 pm

Re: Generating folder/files

Post by owen » Sun Dec 08, 2019 7:05 am

i replaced the + with ; in some of the lines of code for example in the html TITLE

Code: Select all

Dim as string FName
Dim as string MName
Dim as string LName
Dim as string Div
Dim as string Rate
Dim as string SRank
Dim as string SQual
Dim as string Smm
Dim as string Syy
Dim as string ERank
Dim as string EQual
Dim as string Emm
Dim as string Eyy
Dim as string forumurl, T
Dim as string folder
Dim as string filename

Input "enter first name "; FName
Input "enter middle name ";MName
Input "enter last name "; LName
Input "enter division "; Div
Input "enter rate "; Rate
Input "enter starting rank "; SRank
Input "starting SU or SS "; SQual
Input "starting month "; Smm
Input "starting year "; Syy
Input "ending rank ";ERank
Input "ending qual ";EQual
Input "ending month "; Emm
Input "ending year ";Eyy
Input "enter forum T="; T

forumurl="https://usschicagossn721.net/forum/viewtopic.php?f=17&t="+T

folder = LName+"_"+FName+"_"+Syy

mkdir(folder)

filename = folder+"\index.html"

Open filename for output as #1
'-------------------------------
'insert code here to create html


print #1, "<!DOCTYPE html>"
print #1, "<html>"
print #1, "<head>"
print #1, "	<meta name="; chr(34); "viewport"; chr(34); " content="; chr(34); "width=device-width, initial-scale=1.0"; chr(34); ">"
print #1, "	<title>About"; " "; FName ; " " ; LName; "</title>"
print #1, "	<style>"
print #1, "		.textalign {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: grey;"
print #1, "			font-family: century gothic;"
print #1, "			text-align: center;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.content {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: #383939;"
print #1, "			font-family: century gothic;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.highlight {"
print #1, "			color: #6FFFD8;"
print #1, "		}"
print #1, "		.pics{"
print #1, "			border-radius: 20px;"
print #1, "			max-width: 100%;"
print #1, "			height: auto;"
print #1, "		}"
print #1, "		.quicklinks a{"
print #1, "			color: #6FFFD8;"
print #1, "			font-weight: bold;"
print #1, "			text-decoration: none;"
print #1, "		}"
print #1, "		.quicklinks a:hover{"
print #1, "			color: white;"
print #1, "			text-decoration: underline;"
print #1, "		}"
print #1, "	</style>"
print #1, "</head>"
print #1, "<body>"
print #1, "	<div class="; chr(34); "textalign quicklinks"; chr(34); " id="; chr(34); "quick_links"; chr(34); " style="; chr(34); "padding: 5px!important;"; chr(34); ">"
print #1, "		<center>"
print #1, "			<br>"
print #1, "			<a href="; chr(34); "https://usschicagossn721.org"; chr(34); ">"
print #1, "			<img src="; chr(34); "../pics/usslogo.png"; chr(34); " alt="; chr(34); "uss1"; chr(34); " width="; chr(34); "100"; chr(34); " height="; chr(34); "100"; chr(34); " align="; chr(34); "center"; chr(34); " class="; chr(34); "pics"; chr(34); ">"
print #1, "			</a>"
print #1, "			<h1>USS Chicago (SSN-721)</h1>"
print #1, "			<p style="; chr(34); "font-size: 15px;"; chr(34); ">"
print #1, "				<a href="; chr(34); "../index.html#CO"; chr(34); ">CO</a> | "
print #1, "				<a href="; chr(34); "../index.html#XO"; chr(34); ">XO</a> | "
print #1, "				<a href="; chr(34); "../index.html#NAV"; chr(34); ">NAV</a> | "
print #1, "				<a href="; chr(34); "../index.html#WEPS"; chr(34); ">WEPS</a> | "
print #1, "				<a href="; chr(34); "../index.html#ENG"; chr(34); ">ENG</a> | "
print #1, "				<a href="; chr(34); "../index.html#SUPPO"; chr(34); ">SUPPO</a> | "
print #1, "				<a href="; chr(34); "../index.html#JO's"; chr(34); ">JO's</a> | "
print #1, "				<a href="; chr(34); "../index.html#COB"; chr(34); ">COB</a> | "
print #1, "				<a href="; chr(34); "../index.html#HM"; chr(34); ">HM</a> | "
print #1, "				<a href="; chr(34); "../index.html#YN"; chr(34); ">YN</a> | "
print #1, "				<a href="; chr(34); "../index.html#RM_ETR"; chr(34); ">RM&ETR</a> | "
print #1, "				<a href="; chr(34); "../index.html#QM"; chr(34); ">QM</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETV"; chr(34); ">ET&ETV</a> | "
print #1, "				<a href="; chr(34); "../index.html#IC"; chr(34); ">IC</a> | "
print #1, "				<a href="; chr(34); "../index.html#ITS"; chr(34); ">ITS</a> | "
print #1, "				<a href="; chr(34); "../index.html#FTG"; chr(34); ">FTG</a> | "
print #1, "				<a href="; chr(34); "../index.html#TM"; chr(34); ">TM&MMW</a> | "
print #1, "				<a href="; chr(34); "../index.html#STS"; chr(34); ">STS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMA"; chr(34); ">MM&MMA</a> | "
print #1, "				<a href="; chr(34); "../index.html#DD"; chr(34); ">DD</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMN"; chr(34); ">MM&MMN</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETN"; chr(34); ">ET&ETN</a> | "
print #1, "				<a href="; chr(34); "../index.html#EM"; chr(34); ">EM</a> | "
print #1, "				<a href="; chr(34); "../index.html#SK_LS"; chr(34); ">SK&LS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MS_CS"; chr(34); ">MS&CS</a>"
print #1, "			</p>"
print #1, "		</center>"
print #1, "	</div>"
print #1, "	<div class="; chr(34); "textalign"; chr(34); ">"
print #1, "		<h2>";FName ; " " ; MName ; " " ; LName  ;"</h2>"
print #1, "		<h3>";Div;"</h3>"
print #1, "		<h3>";Rate ; SRank;"(";SQual;") ";Smm;"/";Syy;" to ";Rate ; ERank;"(";EQual;") ";Emm;"/";Eyy;"</h3>"
Print #1, "		<a href="; chr(34) ; forumurl ; chr(34); " class="; chr(34); "highlight"; chr(34); ">Forum</a>"
print #1, "	</div> "
print #1, "	<div class="; chr(34); "content"; chr(34); ">"
print #1, "		Enter Page Content Here"
print #1, "	</div>"
print #1, "</body>"
print #1, "</html>"




'-------------------------------
Close #1

Sleep


User avatar
Ichibane
Posts: 50
Joined: Tue Oct 16, 2018 4:37 am

Re: Generating folder/files

Post by Ichibane » Sun Dec 08, 2019 7:37 am

added generating of txt file with the url that will be placed in index of the website

Code: Select all

Dim as string FName
Dim as string MName
Dim as string LName
Dim as string Div
Dim as string Rate
Dim as string SRank
Dim as string SQual
Dim as string Smm
Dim as string Syy
Dim as string ERank
Dim as string EQual
Dim as string Emm
Dim as string Eyy
Dim as string forumurl, T
Dim as string folder
Dim as string filename

Input "enter first name "; FName
Input "enter middle name ";MName
Input "enter last name "; LName
Input "enter division "; Div
Input "enter rate "; Rate
Input "enter starting rank "; SRank
Input "starting SU or SS "; SQual
Input "starting month "; Smm
Input "starting year "; Syy
Input "ending rank ";ERank
Input "ending qual ";EQual
Input "ending month "; Emm
Input "ending year ";Eyy
Input "enter forum T="; T

forumurl="https://usschicagossn721.net/forum/viewtopic.php?f=17&t="+T

folder = LName+"_"+FName+"_"+Syy

mkdir(folder)

filename = folder+"\index.html"

Open filename for output as #1
'-------------------------------
'insert code here to create html


print #1, "<!DOCTYPE html>"
print #1, "<html>"
print #1, "<head>"
print #1, "	<meta name="; chr(34); "viewport"; chr(34); " content="; chr(34); "width=device-width, initial-scale=1.0"; chr(34); ">"
print #1, "	<title>About"; " "; FName; " "; LName; "</title>"
print #1, "	<style>"
print #1, "		.textalign {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: grey;"
print #1, "			font-family: century gothic;"
print #1, "			text-align: center;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.content {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: #383939;"
print #1, "			font-family: century gothic;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.highlight {"
print #1, "			color: #6FFFD8;"
print #1, "		}"
print #1, "		.pics{"
print #1, "			border-radius: 20px;"
print #1, "			max-width: 100%;"
print #1, "			height: auto;"
print #1, "		}"
print #1, "		.quicklinks a{"
print #1, "			color: #6FFFD8;"
print #1, "			font-weight: bold;"
print #1, "			text-decoration: none;"
print #1, "		}"
print #1, "		.quicklinks a:hover{"
print #1, "			color: white;"
print #1, "			text-decoration: underline;"
print #1, "		}"
print #1, "	</style>"
print #1, "</head>"
print #1, "<body>"
print #1, "	<div class="; chr(34); "textalign quicklinks"; chr(34); " id="; chr(34); "quick_links"; chr(34); " style="; chr(34); "padding: 5px!important;"; chr(34); ">"
print #1, "		<center>"
print #1, "			<br>"
print #1, "			<a href="; chr(34); "https://usschicagossn721.org"; chr(34); ">"
print #1, "			<img src="; chr(34); "../pics/usslogo.png"; chr(34); " alt="; chr(34); "uss1"; chr(34); " width="; chr(34); "100"; chr(34); " height="; chr(34); "100"; chr(34); " align="; chr(34); "center"; chr(34); " class="; chr(34); "pics"; chr(34); ">"
print #1, "			</a>"
print #1, "			<h1>USS Chicago (SSN-721)</h1>"
print #1, "			<p style="; chr(34); "font-size: 15px;"; chr(34); ">"
print #1, "				<a href="; chr(34); "../index.html#CO"; chr(34); ">CO</a> | "
print #1, "				<a href="; chr(34); "../index.html#XO"; chr(34); ">XO</a> | "
print #1, "				<a href="; chr(34); "../index.html#NAV"; chr(34); ">NAV</a> | "
print #1, "				<a href="; chr(34); "../index.html#WEPS"; chr(34); ">WEPS</a> | "
print #1, "				<a href="; chr(34); "../index.html#ENG"; chr(34); ">ENG</a> | "
print #1, "				<a href="; chr(34); "../index.html#SUPPO"; chr(34); ">SUPPO</a> | "
print #1, "				<a href="; chr(34); "../index.html#JO's"; chr(34); ">JO's</a> | "
print #1, "				<a href="; chr(34); "../index.html#COB"; chr(34); ">COB</a> | "
print #1, "				<a href="; chr(34); "../index.html#HM"; chr(34); ">HM</a> | "
print #1, "				<a href="; chr(34); "../index.html#YN"; chr(34); ">YN</a> | "
print #1, "				<a href="; chr(34); "../index.html#RM_ETR"; chr(34); ">RM&ETR</a> | "
print #1, "				<a href="; chr(34); "../index.html#QM"; chr(34); ">QM</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETV"; chr(34); ">ET&ETV</a> | "
print #1, "				<a href="; chr(34); "../index.html#IC"; chr(34); ">IC</a> | "
print #1, "				<a href="; chr(34); "../index.html#ITS"; chr(34); ">ITS</a> | "
print #1, "				<a href="; chr(34); "../index.html#FTG"; chr(34); ">FTG</a> | "
print #1, "				<a href="; chr(34); "../index.html#TM"; chr(34); ">TM&MMW</a> | "
print #1, "				<a href="; chr(34); "../index.html#STS"; chr(34); ">STS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMA"; chr(34); ">MM&MMA</a> | "
print #1, "				<a href="; chr(34); "../index.html#DD"; chr(34); ">DD</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMN"; chr(34); ">MM&MMN</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETN"; chr(34); ">ET&ETN</a> | "
print #1, "				<a href="; chr(34); "../index.html#EM"; chr(34); ">EM</a> | "
print #1, "				<a href="; chr(34); "../index.html#SK_LS"; chr(34); ">SK&LS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MS_CS"; chr(34); ">MS&CS</a>"
print #1, "			</p>"
print #1, "		</center>"
print #1, "	</div>"
print #1, "	<div class="; chr(34); "textalign"; chr(34); ">"
print #1, "		<h2>";FName + " " + MName + " " + LName  ;"</h2>"
print #1, "		<h3>";Div;"</h3>"
print #1, "		<h3>";Rate + SRank;"(";SQual;") ";Smm;"/";Syy;" to ";Rate + ERank;"(";EQual;") ";Emm;"/";Eyy;"</h3>"
Print #1, "		<a href="; chr(34) + forumurl + chr(34); " class="; chr(34); "highlight"; chr(34); ">Forum</a>"
print #1, "	</div> "
print #1, "	<div class="; chr(34); "content"; chr(34); ">"
print #1, "		Enter Page Content Here"
print #1, "	</div>"
print #1, "</body>"
print #1, "</html>"
'-------------------------------
Close #1

Open folder+"\url.txt" for output as #1
Print #1, Div
Print #1, ""
Print #1, "<a href=";Chr(34);folder;"/index.html";Chr(34);" class=";chr(34);"highlight";chr(34);">";FName;" ";LName;" ";Rate + SRank;"(";SQual;") ";Smm;"/";Syy;" to ";Rate + ERank;"(";EQual;") ";Emm;"/";Eyy;"</a> RM3(SU) 11/86 to RM2(SS) 03/91 Specomm<br>"
Close #1

Sleep

owen
Site Admin
Posts: 654
Joined: Thu Apr 13, 2017 12:14 pm

Re: Generating folder/files

Post by owen » Sun Dec 08, 2019 7:53 am

Code: Select all

Dim as string FName
Dim as string MName
Dim as string LName
Dim as string Div
Dim as string Rate
Dim as string SRank
Dim as string SQual
Dim as string Smm
Dim as string Syy
Dim as string ERank
Dim as string EQual
Dim as string Emm
Dim as string Eyy
Dim as string forumurl, T
Dim as string folder
Dim as string filename
dim as string notes

Input "enter first name "; FName
Input "enter middle name ";MName
Input "enter last name "; LName
Input "enter division "; Div
Input "enter rate "; Rate
Input "enter starting rank "; SRank
Input "starting SU or SS "; SQual
Input "starting month "; Smm
Input "starting year "; Syy
Input "ending rank ";ERank
Input "ending qual ";EQual
Input "ending month "; Emm
Input "ending year ";Eyy
input "enter notes ";notes
Input "enter forum T="; T

forumurl="https://usschicagossn721.net/forum/viewtopic.php?f=17&t="+T

folder = LName+"_"+FName+"_"+Syy

mkdir(folder)

filename = folder+"\index.html"

Open filename for output as #1
'-------------------------------
'insert code here to create html


print #1, "<!DOCTYPE html>"
print #1, "<html>"
print #1, "<head>"
print #1, "	<meta name="; chr(34); "viewport"; chr(34); " content="; chr(34); "width=device-width, initial-scale=1.0"; chr(34); ">"
print #1, "	<title>About"; " "; FName; " "; LName; "</title>"
print #1, "	<style>"
print #1, "		.textalign {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: grey;"
print #1, "			font-family: century gothic;"
print #1, "			text-align: center;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.content {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: #383939;"
print #1, "			font-family: century gothic;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.highlight {"
print #1, "			color: #6FFFD8;"
print #1, "		}"
print #1, "		.pics{"
print #1, "			border-radius: 20px;"
print #1, "			max-width: 100%;"
print #1, "			height: auto;"
print #1, "		}"
print #1, "		.quicklinks a{"
print #1, "			color: #6FFFD8;"
print #1, "			font-weight: bold;"
print #1, "			text-decoration: none;"
print #1, "		}"
print #1, "		.quicklinks a:hover{"
print #1, "			color: white;"
print #1, "			text-decoration: underline;"
print #1, "		}"
print #1, "	</style>"
print #1, "</head>"
print #1, "<body>"
print #1, "	<div class="; chr(34); "textalign quicklinks"; chr(34); " id="; chr(34); "quick_links"; chr(34); " style="; chr(34); "padding: 5px!important;"; chr(34); ">"
print #1, "		<center>"
print #1, "			<br>"
print #1, "			<a href="; chr(34); "https://usschicagossn721.org"; chr(34); ">"
print #1, "			<img src="; chr(34); "../pics/usslogo.png"; chr(34); " alt="; chr(34); "uss1"; chr(34); " width="; chr(34); "100"; chr(34); " height="; chr(34); "100"; chr(34); " align="; chr(34); "center"; chr(34); " class="; chr(34); "pics"; chr(34); ">"
print #1, "			</a>"
print #1, "			<h1>USS Chicago (SSN-721)</h1>"
print #1, "			<p style="; chr(34); "font-size: 15px;"; chr(34); ">"
print #1, "				<a href="; chr(34); "../index.html#CO"; chr(34); ">CO</a> | "
print #1, "				<a href="; chr(34); "../index.html#XO"; chr(34); ">XO</a> | "
print #1, "				<a href="; chr(34); "../index.html#NAV"; chr(34); ">NAV</a> | "
print #1, "				<a href="; chr(34); "../index.html#WEPS"; chr(34); ">WEPS</a> | "
print #1, "				<a href="; chr(34); "../index.html#ENG"; chr(34); ">ENG</a> | "
print #1, "				<a href="; chr(34); "../index.html#SUPPO"; chr(34); ">SUPPO</a> | "
print #1, "				<a href="; chr(34); "../index.html#JO's"; chr(34); ">JO's</a> | "
print #1, "				<a href="; chr(34); "../index.html#COB"; chr(34); ">COB</a> | "
print #1, "				<a href="; chr(34); "../index.html#HM"; chr(34); ">HM</a> | "
print #1, "				<a href="; chr(34); "../index.html#YN"; chr(34); ">YN</a> | "
print #1, "				<a href="; chr(34); "../index.html#RM_ETR"; chr(34); ">RM&ETR</a> | "
print #1, "				<a href="; chr(34); "../index.html#QM"; chr(34); ">QM</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETV"; chr(34); ">ET&ETV</a> | "
print #1, "				<a href="; chr(34); "../index.html#IC"; chr(34); ">IC</a> | "
print #1, "				<a href="; chr(34); "../index.html#ITS"; chr(34); ">ITS</a> | "
print #1, "				<a href="; chr(34); "../index.html#FTG"; chr(34); ">FTG</a> | "
print #1, "				<a href="; chr(34); "../index.html#TM"; chr(34); ">TM&MMW</a> | "
print #1, "				<a href="; chr(34); "../index.html#STS"; chr(34); ">STS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMA"; chr(34); ">MM&MMA</a> | "
print #1, "				<a href="; chr(34); "../index.html#DD"; chr(34); ">DD</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMN"; chr(34); ">MM&MMN</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETN"; chr(34); ">ET&ETN</a> | "
print #1, "				<a href="; chr(34); "../index.html#EM"; chr(34); ">EM</a> | "
print #1, "				<a href="; chr(34); "../index.html#SK_LS"; chr(34); ">SK&LS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MS_CS"; chr(34); ">MS&CS</a>"
print #1, "			</p>"
print #1, "		</center>"
print #1, "	</div>"
print #1, "	<div class="; chr(34); "textalign"; chr(34); ">"
print #1, "		<h2>";FName + " " + MName + " " + LName  ;"</h2>"
print #1, "		<h3>";Div;"</h3>"
print #1, "		<h3>";Rate + SRank;"(";SQual;") ";Smm;"/";Syy;" to ";Rate + ERank;"(";EQual;") ";Emm;"/";Eyy;"</h3>"
Print #1, "		<a href="; chr(34) + forumurl + chr(34); " class="; chr(34); "highlight"; chr(34); ">Forum</a>"
print #1, "	</div> "
print #1, "	<div class="; chr(34); "content"; chr(34); ">"
print #1, "		Enter Page Content Here"
print #1, "	</div>"
print #1, "</body>"
print #1, "</html>"
'-------------------------------
Close #1

Open folder+"\url.txt" for output as #1
Print #1, "<a href=";Chr(34);folder;"/index.html";Chr(34);" class=";chr(34);"highlight";chr(34);">";FName;" ";Mname;" ";LName;"</a> ";Rate; SRank;"(";SQual;") ";Smm;"/";Syy;" to ";Rate ; ERank;"(";EQual;") ";Emm;"/";Eyy;" ";notes;"<br>"
Close #1

Sleep

owen
Site Admin
Posts: 654
Joined: Thu Apr 13, 2017 12:14 pm

Re: Generating folder/files

Post by owen » Sun Dec 08, 2019 8:05 am

fixed lower case for folder name

Code: Select all

Dim as string FName
Dim as string MName
Dim as string LName
Dim as string Div
Dim as string Rate
Dim as string SRank
Dim as string SQual
Dim as string Smm
Dim as string Syy
Dim as string ERank
Dim as string EQual
Dim as string Emm
Dim as string Eyy
Dim as string forumurl, T
Dim as string folder
Dim as string filename
dim as string notes

Input "enter first name "; FName
Input "enter middle name ";MName
Input "enter last name "; LName
Input "enter division "; Div
Input "enter rate "; Rate
Input "enter starting rank "; SRank
Input "starting SU or SS "; SQual
Input "starting month "; Smm
Input "starting year "; Syy
Input "ending rank ";ERank
Input "ending qual ";EQual
Input "ending month "; Emm
Input "ending year ";Eyy
input "enter notes ";notes
Input "enter forum T="; T

forumurl="https://usschicagossn721.net/forum/viewtopic.php?f=17&t="+T

folder = lcase(LName)+"_"+lcase(FName)+"_"+Syy

mkdir(folder)

filename = folder+"\index.html"

Open filename for output as #1
'-------------------------------
'insert code here to create html


print #1, "<!DOCTYPE html>"
print #1, "<html>"
print #1, "<head>"
print #1, "	<meta name="; chr(34); "viewport"; chr(34); " content="; chr(34); "width=device-width, initial-scale=1.0"; chr(34); ">"
print #1, "	<title>About"; " "; FName; " "; LName; "</title>"
print #1, "	<style>"
print #1, "		.textalign {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: grey;"
print #1, "			font-family: century gothic;"
print #1, "			text-align: center;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.content {"
print #1, "			border-radius: 25px;"
print #1, "			background-color: #383939;"
print #1, "			font-family: century gothic;"
print #1, "			color: white;"
print #1, "			margin: 20px;"
print #1, "			padding: 20px;"
print #1, "		}"
print #1, "		.highlight {"
print #1, "			color: #6FFFD8;"
print #1, "		}"
print #1, "		.pics{"
print #1, "			border-radius: 20px;"
print #1, "			max-width: 100%;"
print #1, "			height: auto;"
print #1, "		}"
print #1, "		.quicklinks a{"
print #1, "			color: #6FFFD8;"
print #1, "			font-weight: bold;"
print #1, "			text-decoration: none;"
print #1, "		}"
print #1, "		.quicklinks a:hover{"
print #1, "			color: white;"
print #1, "			text-decoration: underline;"
print #1, "		}"
print #1, "	</style>"
print #1, "</head>"
print #1, "<body>"
print #1, "	<div class="; chr(34); "textalign quicklinks"; chr(34); " id="; chr(34); "quick_links"; chr(34); " style="; chr(34); "padding: 5px!important;"; chr(34); ">"
print #1, "		<center>"
print #1, "			<br>"
print #1, "			<a href="; chr(34); "https://usschicagossn721.org"; chr(34); ">"
print #1, "			<img src="; chr(34); "../pics/usslogo.png"; chr(34); " alt="; chr(34); "uss1"; chr(34); " width="; chr(34); "100"; chr(34); " height="; chr(34); "100"; chr(34); " align="; chr(34); "center"; chr(34); " class="; chr(34); "pics"; chr(34); ">"
print #1, "			</a>"
print #1, "			<h1>USS Chicago (SSN-721)</h1>"
print #1, "			<p style="; chr(34); "font-size: 15px;"; chr(34); ">"
print #1, "				<a href="; chr(34); "../index.html#CO"; chr(34); ">CO</a> | "
print #1, "				<a href="; chr(34); "../index.html#XO"; chr(34); ">XO</a> | "
print #1, "				<a href="; chr(34); "../index.html#NAV"; chr(34); ">NAV</a> | "
print #1, "				<a href="; chr(34); "../index.html#WEPS"; chr(34); ">WEPS</a> | "
print #1, "				<a href="; chr(34); "../index.html#ENG"; chr(34); ">ENG</a> | "
print #1, "				<a href="; chr(34); "../index.html#SUPPO"; chr(34); ">SUPPO</a> | "
print #1, "				<a href="; chr(34); "../index.html#JO's"; chr(34); ">JO's</a> | "
print #1, "				<a href="; chr(34); "../index.html#COB"; chr(34); ">COB</a> | "
print #1, "				<a href="; chr(34); "../index.html#HM"; chr(34); ">HM</a> | "
print #1, "				<a href="; chr(34); "../index.html#YN"; chr(34); ">YN</a> | "
print #1, "				<a href="; chr(34); "../index.html#RM_ETR"; chr(34); ">RM&ETR</a> | "
print #1, "				<a href="; chr(34); "../index.html#QM"; chr(34); ">QM</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETV"; chr(34); ">ET&ETV</a> | "
print #1, "				<a href="; chr(34); "../index.html#IC"; chr(34); ">IC</a> | "
print #1, "				<a href="; chr(34); "../index.html#ITS"; chr(34); ">ITS</a> | "
print #1, "				<a href="; chr(34); "../index.html#FTG"; chr(34); ">FTG</a> | "
print #1, "				<a href="; chr(34); "../index.html#TM"; chr(34); ">TM&MMW</a> | "
print #1, "				<a href="; chr(34); "../index.html#STS"; chr(34); ">STS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMA"; chr(34); ">MM&MMA</a> | "
print #1, "				<a href="; chr(34); "../index.html#DD"; chr(34); ">DD</a> | "
print #1, "				<a href="; chr(34); "../index.html#MM_MMN"; chr(34); ">MM&MMN</a> | "
print #1, "				<a href="; chr(34); "../index.html#ET_ETN"; chr(34); ">ET&ETN</a> | "
print #1, "				<a href="; chr(34); "../index.html#EM"; chr(34); ">EM</a> | "
print #1, "				<a href="; chr(34); "../index.html#SK_LS"; chr(34); ">SK&LS</a> | "
print #1, "				<a href="; chr(34); "../index.html#MS_CS"; chr(34); ">MS&CS</a>"
print #1, "			</p>"
print #1, "		</center>"
print #1, "	</div>"
print #1, "	<div class="; chr(34); "textalign"; chr(34); ">"
print #1, "		<h2>";FName + " " + MName + " " + LName  ;"</h2>"
print #1, "		<h3>";Div;"</h3>"
print #1, "		<h3>";Rate + SRank;"(";SQual;") ";Smm;"/";Syy;" to ";Rate + ERank;"(";EQual;") ";Emm;"/";Eyy;"</h3>"
Print #1, "		<a href="; chr(34) + forumurl + chr(34); " class="; chr(34); "highlight"; chr(34); ">Forum</a>"
print #1, "	</div> "
print #1, "	<div class="; chr(34); "content"; chr(34); ">"
print #1, "		Enter Page Content Here"
print #1, "	</div>"
print #1, "</body>"
print #1, "</html>"
'-------------------------------
Close #1

Open folder+"\url.txt" for output as #1
Print #1, "<a href=";Chr(34);folder;"/index.html";Chr(34);" class=";chr(34);"highlight";chr(34);">";FName;" ";Mname;" ";LName;"</a> ";Rate; SRank;"(";SQual;") ";Smm;"/";Syy;" to ";Rate ; ERank;"(";EQual;") ";Emm;"/";Eyy;" ";notes;"<br>"
Close #1

Sleep

Post Reply