setting an old list and comparing the two

i have a list lets call it list1 and i have a repeat loop, at the start list1 gets its vaoues at the end of the loop list2 gets the values of list1.

inbetweeen the two list declarations there is an if statement that compares the new list againts the previous list, if its the same then something else should be done.

But it doesn’t work. That is the idea anyway. Here is my actual code


property elementList : {"imageNumber", "libNumber", "physLocation", "fileTitle", "fileKeyword", "fileCaption", "fileOrient", "fileFormat", "fileRestrictions", "filePhoto", "digialOnly"}
property elementValueList : {"", "", "", "", "", "", "", "", "", "", ""}
property imageNumberFile : "Shared G4 HD:Users:karrenmay:Desktop:imageNumberForGetDetails.txt" as alias
property uploadN : "Shared G4 HD:Users:karrenmay:Desktop:uploadNFile.txt" as alias

set imageNumber to read imageNumberFile
set N to read uploadN



set excelFile to "Shared G4 HD:Users:karrenmay:Desktop:test.xls"
set columnList to {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"}
set elementCount to count elementList
set start_ to current date

try
	
	tell application "Microsoft Excel"
		try
			launch
			Open excelFile
			
		on error
			stop
		end try
	end tell
	
	repeat with h from 1 to 2
		try
			
			tell application "Internet Explorer"  --<---in this tell i set the lists values
				try
					
					OpenURL "http://www.bl......es.com/admin/libupdate.asp?updimage=" & imageNumber & "&high=&low="
					delay 2.5
					
					repeat with i from 1 to elementCount
						
						set elementItem to item i of elementList
						if i = 1 then
							set item i of elementValueList to imageNumber
						else if i is equal to 7 or i is equal to 12 then
						else
							set item i of elementValueList to do script "window.document.forms[0].elements[" & (i - 2) & "].value"
						end if
						
					end repeat
				on error theError
					display dialog theError
				end try
				
			end tell
			
			tell application "Microsoft Excel"
				set theRow to "R" & (N + 3)
				
				if elementList is equal to oldList then --<---- this is where i check the oldlist against the new
					repeat with j from 1 to (count columnList)
						
						set valueOf to theRow & "C" & j
						if j = 1 then
							set Formula of Cell valueOf to imageNumber
						else
							set Formula of Cell valueOf to "XXXXXXXXXXX"
						end if
					end repeat
				else
					repeat with j from 1 to (count columnList)
						
						set valueOf to theRow & "C" & j
						
						set Formula of Cell valueOf to item j of elementValueList
						
					end repeat
				end if
			end tell
			set oldList to elementList --<---- this is where i copy the list
			
			set N to (N + 1)
			set imageNumber to (imageNumber + 1)
		on error
			exit repeat
		end try
		
	end repeat
	
	set finish_ to current date
	set timeTaken to (finish_ - start_)
	set minutes_ to (timeTaken / 60)
	activate
	if timeTaken > 60 then
		display dialog "Took " & timeTaken & " seconds to complete the script" & return & "Which is roughly: " & minutes_ & " minutes"
	else
		display dialog "Took " & timeTaken & " seconds to complete the script"
	end if
on error theError
	display dialog theError
end try
my incrementFile("" & imageNumber & "", imageNumberFile, true)
my incrementFile("" & N & "", uploadN, true)

on incrementFile(thisdata, targetfile, appenddata)
	try
		set the targetfile to the targetfile as text
		set the opentargetfile to ¬
			open for access file targetfile with write permission
		if appenddata is false then ¬
			set eof of the opentargetfile to 0
		write thisdata to the opentargetfile
		close access the opentargetfile
		return true
	on error
		try
			close access file targetfile
		end try
		return false
	end try
end incrementFile

I cant seem to copy the list, i have display’d dialogs all over but no luckm it does set the list but cant do the oldlist, this is an added feature that i wish to add tothis script incase there are any connection error messages and can then go through the excel sheet after and re inputt the details.

:shock: Ok, there’s a lot to try to wade through and I can’t even attempt to compile the code because I don’t have all of the required apps. Can you provide some pseudo code to demontrate what you are working with and what you hope to accomplish?

– Rob

Sorry rob i have solved the problem.

Butw hat i wanted to do was basically get some details form a site and check it against the last site i checked. If they were the same then i wanted to add “XXXXXXX” to cell whatever and if they werent the same then i wanted to input the list into the same document.

The problem was and i didnt realise was that in the old and new lists i had a different ID number which was the unique image number. So they would never be the same list due to this.

but all i had o do was make sure tyhat this unique number wasn’t inserted into the list.