home *** CD-ROM | disk | FTP | other *** search
- on convertxl
- loadtext()
- createnewdatabasescript()
- end
-
- on loadtext
- set fioObject to new(xtra("fileio"))
- set fileName to displayOpen(fioObject)
- openFile(fioObject, fileName, 1)
- set content to readFile(fioObject)
- closeFile(fioObject)
- set fioObject to EMPTY
- put content into field "loadedtext"
- end
-
- on createnewdatabasescript
- global SOFfeaturedlist, SOFentertainmentlist, SOFdevelopmentlist, SOFsoholist, SOFutilitieslist
- set SOFfeaturedlist to list()
- set SOFentertainmentlist to list()
- set SOFdevelopmentlist to list()
- set SOFsoholist to list()
- set SOFutilitieslist to list()
- set numberofrecords to the number of lines in field "loadedtext"
- if line numberofrecords of field "loadedtext" = EMPTY then
- set numberofrecords to numberofrecords - 1
- end if
- repeat with i = 1 to numberofrecords
- set thisrecord to line i of field "loadedtext"
- set thispropertylist to puttextstringintopropertylist(thisrecord)
- case the section of thispropertylist of
- "entertainment":
- set howmanyrecords to count(SOFentertainmentlist)
- set itemNumber to howmanyrecords + 1
- set thispropertyname to "prog" & itemNumber
- if itemNumber = 1 then
- set actionstring to "set SOFentertainmentlist = [" & thispropertyname & ":thispropertylist]"
- do(actionstring)
- else
- addProp(SOFentertainmentlist, thispropertyname, thispropertylist)
- end if
- "development":
- set howmanyrecords to count(SOFdevelopmentlist)
- set itemNumber to howmanyrecords + 1
- set thispropertyname to "prog" & itemNumber
- if itemNumber = 1 then
- set actionstring to "set SOFdevelopmentlist = [" & thispropertyname & ":thispropertylist]"
- do(actionstring)
- else
- addProp(SOFdevelopmentlist, thispropertyname, thispropertylist)
- end if
- "utilities":
- set howmanyrecords to count(SOFutilitieslist)
- set itemNumber to howmanyrecords + 1
- set thispropertyname to "prog" & itemNumber
- if itemNumber = 1 then
- set actionstring to "set SOFutilitieslist = [" & thispropertyname & ":thispropertylist]"
- do(actionstring)
- else
- addProp(SOFutilitieslist, thispropertyname, thispropertylist)
- end if
- "soho":
- set howmanyrecords to count(SOFsoholist)
- set itemNumber to howmanyrecords + 1
- set thispropertyname to "prog" & itemNumber
- if itemNumber = 1 then
- set actionstring to "set SOFsoholist = [" & thispropertyname & ":thispropertylist]"
- do(actionstring)
- else
- addProp(SOFsoholist, thispropertyname, thispropertylist)
- end if
- end case
- if the featured of thispropertylist = "1" then
- set howmanyrecords to count(SOFfeaturedlist)
- set itemNumber to howmanyrecords + 1
- set thispropertyname to "prog" & itemNumber
- if itemNumber = 1 then
- set actionstring to "set SOFfeaturedlist = [" & thispropertyname & ":thispropertylist]"
- do(actionstring)
- next repeat
- end if
- addProp(SOFfeaturedlist, thispropertyname, thispropertylist)
- end if
- end repeat
- set SOFfeaturedliststring to string(SOFfeaturedlist)
- set SOFentertainmentliststring to string(SOFentertainmentlist)
- set SOFdevelopmentliststring to string(SOFdevelopmentlist)
- set SOFutilitiesliststring to string(SOFutilitieslist)
- set SOFsoholiststring to string(SOFsoholist)
- set scriptstring to EMPTY
- put "on setupdatabaseglobals" & RETURN & RETURN after scriptstring
- put "global SOFfeaturedlist,SOFentertainmentlist,SOFdevelopmentlist,SOFsoholist,SOFutilitieslist" & RETURN & RETURN after scriptstring
- put "set SOFfeaturedlist = " & SOFfeaturedliststring & RETURN & RETURN after scriptstring
- put "set SOFentertainmentlist = " & SOFentertainmentliststring & RETURN & RETURN after scriptstring
- put "set SOFdevelopmentlist = " & SOFdevelopmentliststring & RETURN & RETURN after scriptstring
- put "set SOFutilitieslist = " & SOFutilitiesliststring & RETURN & RETURN after scriptstring
- put "set SOFsoholist = " & SOFsoholiststring & RETURN & RETURN after scriptstring
- put "end setupdatabaseglobals" after scriptstring
- set the scriptText of member "setupdatabaseglobals" to scriptstring
- set SOFfeaturedlist to EMPTY
- set SOFentertainmentlist to EMPTY
- set SOFdevelopmentlist to EMPTY
- set SOFutilitieslist to EMPTY
- set SOFsoholist to EMPTY
- end
-
- on puttextstringintopropertylist thisrecord
- set DataEntryThisRecordData to [#productName: EMPTY, #version: EMPTY, #platform: EMPTY, #category: EMPTY, #productinfo: EMPTY, #systemreqs: EMPTY, #uninstallinfo: EMPTY, #playinstcopy: EMPTY, #size: EMPTY, #salesenquiries: EMPTY, #techsupport: EMPTY, #weblink: EMPTY, #section: EMPTY, #installpathname: EMPTY, #screenshot: EMPTY, #sound: EMPTY, #video: EMPTY, #featured: EMPTY]
- set fieldtext to EMPTY
- set startcharacter to 1
- set fieldnumber to 1
- repeat with i = 1 to the number of chars in thisrecord
- if char i of thisrecord = TAB then
- set fieldtext to chars(thisrecord, startcharacter, i - 1)
- set thisproperty to getPropAt(DataEntryThisRecordData, fieldnumber)
- setaProp(DataEntryThisRecordData, thisproperty, fieldtext)
- set startcharacter to i + 1
- set fieldnumber to fieldnumber + 1
- end if
- if (char i of thisrecord <> TAB) and (i = the number of chars in thisrecord) then
- set fieldtext to chars(thisrecord, startcharacter, the number of chars in thisrecord)
- set thisproperty to getPropAt(DataEntryThisRecordData, fieldnumber)
- setaProp(DataEntryThisRecordData, thisproperty, fieldtext)
- end if
- end repeat
- return DataEntryThisRecordData
- end
-