Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Property List - Save a copy before clearing 1

Status
Not open for further replies.

MsPepperMintUSA

Programmer
Mar 15, 2001
52
0
0
US
The background:
Trying to modify an application that utilizes the
Accessibility Xtra.

There are 3 different cast members with
just text that generate the list of pdfs.
Each word or group of words is a frame that references a criterion number.

I'll refer to the cast members Catergory 1, Category 2, and Category 3.

The exisiting code allows a user to select different words or groups of words. It's works great. Upon selecting the word or group of words, the displayed list of related PDFs will decrease or increase accordingly. The search can be refined by moving forward into the search (i.e. from Category 1 to Category 2 to Category 3).

I'm trying to capture the items from Category 1 and Category 2 so when my user clicks on my "back" button, it will know which words should be selected and which pdfs should be displayed.

I know I need to modify the following code by using the values from the property list, but have not identified how to save the values from the property list within the existing code. The code is called at the beginning of the frames for Category 1, Category 2 and Category 3

Any suggestions?

Thanks In Advance!
MsPepperMint USA

Below is the code:

global selectedCriteriaList, pdfPath, projList, pdfList, speechStatus, accessible, resultsActive, curResultLine

on startMovie
dosRegister("8FG4859-1ABMLJC")
speechStatus = voiceInitialize()
accessible = 0

if dosFindApp("pdf") = "" then
pdfPath = the pathname & "Reader\AcroRd32.exe"
else
pdfPath = dosFindApp("pdf")
end if

the floatPrecision = 1
selectedCriteriaList = []

generateProjectList
generatePDFList
end

on prepareMovie
the alertHook = script "Alert"
end

on readsearchresults

if resultsActive then
totalResultsNum = member("Matching List").line.count

if (the key).charToNum = 30 then

if member("Matching List").line[1] = "" then
voiceSpeak("There are no results.")
else if curResultLine > 1 then
curResultLine = curResultLine-1
speakLine = "result number" && curResultLine & "." && member("Matching List").line[curResultLine]
voiceSpeak(speakLine)
else
voiceSpeak("You are at the beginning of the list")
end if

else if (the key).charToNum = 31 then

if member("matching list").line[1] = "" then
voiceSpeak("There are no results.")
else if curResultLine < totalResultsNum then
curResultLine = curResultLine+1
speakLine = "result number" && curResultLine & "." && member("Matching List").line[curResultLine]
voiceSpeak(speakLine)
else
voiceSpeak("There are no more results")
end if

else if (the key).charToNum = 29 then

if member("Matching List").line[1] = "" then
voiceSpeak("There are no results.")
else if curResultLine > 0 then
projectName = member("Matching List").line[curResultLine]
docPosition = getPos(projList, projectName)
if docPosition = 0 then
exit
end if
document = getAt(pdfList, docPosition)
docPath = "pdfs\" & document

open docPath with pdfPath
speakLine = "opening" && projectName & " P D F."
voiceSpeak(speakLine)
end if

end if
end if
end


on openPDF myPDF
docPath = the moviepath & "pdfs\prevention\" & myPDF
if accessible then
pdfPath = dosFindApp("pdf")
if pdfpath = "" then
voiceSpeak("Adobe Acrobat could not be found. Please visit the Adobe website at and download the Adobe Acrobat Reader to access this file.")
exit
end if
end if
open docPath with pdfPath
end


on generateProjectList

projList = []

repeat with lineNum = 1 to member("tier3").line.count
contents = member("tier3").line[lineNum]

-- parse project from data
dataOffset = offset("(",contents)
projectName = contents.char[1..dataOffset-2]
projList.append(projectName)
end repeat

end


on generatePDFList

pdfList = []

repeat with lineNum = 1 to member("PDFs").line.count
pdfName = member("PDFs").line[lineNum]
pdfList.append(pdfName)
end repeat

end


on checkCriterion clickCriterion
listPosition = getPos(selectedCriteriaList, clickCriterion)

if listPosition = 0 then
sprite(the clickon).blend = 70
append selectedCriteriaList, clickCriterion
else
sprite(the clickon).blend = 0
deleteAt(selectedCriteriaList, listPosition)
end if


changeCriteriaList

end


on checkCriterion508 clickCriterion, mySprite
listPosition = getPos(selectedCriteriaList, clickCriterion)

if listPosition = 0 then
sprite(mySprite).blend = 70
append selectedCriteriaList, clickCriterion
if accessible then
speakStatus = "Selected."
end if
else
sprite(mySprite).blend = 0
deleteAt(selectedCriteriaList, listPosition)
if accessible then
speakStatus = "D Selected."
end if
end if

curResultLine = 0
changeCriteriaList

totalResultsNum = member("Matching List").line.count - 1
if member("Matching List").line[1] = "" then totalResultsNum = 0
speakLine = speakStatus && "There are" && totalResultsNum && "results"
if accessible then
voiceSpeak(speakLine)
end if
end



on changeCriteriaList
matchingList = ""
clickedCriterion = float(clickedCriterion)

repeat with lineNum = 1 to member("tier3").line.count
contents = member("tier3").line[lineNum]

-- parse project from data
dataOffset = offset("(",contents)
projectName = contents.char[1..dataOffset-2]
dataset = contents.char[(dataOffset+1)..(contents.char.count-1)]

match = 1

-- match criteria against dataset
repeat with criterion = 1 to selectedCriteriaList.count
if dataset contains (getAt(selectedCriteriaList, criterion)) then
nothing
else
match = 0
exit repeat
end if
end repeat

if match = 1 then
matchingList = matchingList & projectName & Return
end if

end repeat

if selectedCriteriaList = [] then
sprite(4).member = "No Search"
member("Matching List").text = ""
member("Matching List").boxType = #fixed
else
sprite(4).member = "Search Results"

if matchingList = "" then
member("Matching List").text = "Your search has returned no results. Please remove some catagories to broaden the search."
member("Matching List").boxType = #fixed
else

member("Matching List").text = matchingList

if member("Matching List").text.line.count > 24 then
member("Matching List").boxType = #scroll
else
member("Matching List").boxType = #fixed
end if

end if

end if

 
Thanks for the advice, initially I was trying to set the array I mean property list to the place holder property list like this:

selCriteriaList = selCategory1List

I've been trying to use the duplicate function, but can't seem to call it in the correct place. Below is the code that I have written but keep getting an error:

I've changed variable names from
selectedCategory1List to selCategory1List
selectedCategory2List to selCategory2List


Modified this script:
global selectedCriteriaList, pdfPath, projList, pdfList, speechStatus, accessible, resultsActive, curResultLine, backButtonStatus, backButtonList, selectedCategory1List, selectedCategory2List, selectedCategory3List

on startMovie
dosRegister("XFTH857-4ABMLJK")
speechStatus = voiceInitialize()
accessible = 0

if dosFindApp("pdf") = "" then
pdfPath = the pathname & "Reader\AcroRd32.exe"
else
pdfPath = dosFindApp("pdf")
end if

the floatPrecision = 1
-- selectedCriteriaList = []
displayBackButtonList
generateProjectList
generatePDFList
end


Added these scripts:
on captureBackButtonList
if backButtonStatus = 0 then
selCategory1List = []
selCategory2List = []
else if backButtonStatus = 1 then
selCategory1List = duplicate(selectedCriteriaList)
put selectedCategory1List
else if backButtonStatus = 2 then
selCategory2List = duplicate(selectedCriteriaList)
put selCategory1List
end if
end

on displayBackButtonList
if backButtonStatus = 0 then
selectedCriteriaList = []
selCategory1List = []
selCategory2List = []
else if backButtonStatus = 1 then
selectedCriteriaList = selCategory1List
else if backButtonStatus = 2 then
selectedCriteriaList = selCategory2List
end if
end



 
I'm an new to the Director programming (started in July 2004). So I am sure my mistake is a newbie mistake.

My error is that no error is generated. I keep calling the function I wrote, but maybe I'm not calling it at the correct event.

I can't tell if any of the newly declared property list were initialized and can't determine where to capture the orginial value.

I also can't determine how to make a frame/sprite activate by code (what I mean by activate is to make it selected like when the cursor event highlights an item.) I've read through several books but can't seem to identify how to replicate this process (highlighting a text sprite) with code.
 
>My error is that no error is generated.
Sounds like a good news! Anyway the best way to find out what's happening is to use the debugger and go through your script step by step.

The other issue: to highlight a text, use hilite().

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top