IMDbPY + DEVONthink

To solve my problem described in this post (storing IMDb-Data in DEVONthink) i copied and pasted this together:
(1) Install IMDbPY
(2) Use this Applescript:

tell application "DEVONthink Pro"
	try
		repeat
			display dialog "Enter IMDb Movie ID:" default answer "" buttons {"Cancel", "OK"} default button 2
			set theID to the text returned of the result
			if theID is not "" then exit repeat
		end repeat
		
		try
			set theOutput to do shell script "/PathToThePythonScript/get_movie.py " & (quoted form of theID)
		end try
		
		if length of theOutput is greater than 0 then
			create record with {name:theID, type:txt, plain text:theOutput}
		end if
	on error error_message number error_number
		if the error_number is not -128 then
			try
				display alert "DEVONthink Pro" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

I suppose there are more direct solutions, but for me it does the job.