MACSCRPT Archives

February 2012

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Mark Lively <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 10 Feb 2012 17:35:16 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (1 lines)
This should be closer to what you are looking for.  Save it as stay open.  It will hang out for 5 minutes after the first file has been dropped waiting for a second different file.



property file_1 : ""

property runtime : 0



on idle

	if runtime < (current date) - 5 * minutes then

		set file_1 to ""

		quit

	end if

	return 1

end idle



on open (droppedItemsList)

	set runtime to current date

	if (number of droppedItemsList) ≥ 3 then

		display dialog "This droplet accepts two files"

		return

	else if (number of droppedItemsList) = 1 then

		if file_1 = "" then

			set file_1 to first item of (droppedItemsList)

			set file_1 to POSIX path of file_1

			return

		else

			set file_2 to first item of (droppedItemsList)

			set file_2 to POSIX path of file_2

		end if

	else if (number of droppedItemsList) = 2 then

		set file_1 to first item of (droppedItemsList)

		set file_1 to POSIX path of file_1

		

		set file_2 to second item of (droppedItemsList)

		set file_2 to POSIX path of file_2

	end if

	if file_1 = file_2 then

		display dialog "You have chosen the same file. Quitting..."

		return

	end if

	

	display dialog file_1 & return & " compared with " & return & file_2

	quit

end open



-Mark



On Feb 10, 2012, at 9:53 AM, Nobumi Iyanaga wrote:



> 

> on open (droppedItemsList)

> 	if (number of droppedItemsList) ≥ 3 then

> 		display dialog "This droplet accepts two files"

> 		return

> 	else if (number of droppedItemsList) = 1 then

> 		set file_1 to first item of (droppedItemsList)

> 		set file_1 to POSIX path of file_1

> 		set file_2 to choose file with prompt "Please choose a file to compare..." of type {"txt", "rtf", "doc", "docx", "odf", "html", "xml"}

> 		set file_2 to POSIX path of file_2

> 	else if (number of droppedItemsList) = 2 then

> 		set file_1 to first item of (droppedItemsList)

> 		set file_1 to POSIX path of file_1

> 		

> 		set file_2 to second item of (droppedItemsList)

> 		set file_2 to POSIX path of file_2

> 	end if

> 	if file_1 = file_2 then

> 		display dialog "You have chosen the same file; please choose another one..."

> 		set file_2 to choose file with prompt "Please choose a file to compare... The first file is " & file_1 & "..." of type {"txt", "rtf", "doc", "docx", "odf", "html", "xml"}

> 		set file_2 to POSIX path of file_2

> 	end if

> 	if file_1 = file_2 then

> 		display dialog "You have chosen the same file. Quitting..."

> 		return

> 	end if

> 	

> 	display dialog file_1 & return & " compared with " & return & file_2

> 	return

> end open




ATOM RSS1 RSS2