version = {"1.0.0", "Charles Ross", "17-11-18"}

tell application "System Events"
	tell process "FileMaker Pro Advanced"
		set frontmost to true
		
		set folder_name to do shell script "date +%Y-%m-%d-%H-%M-%S"
		
		delay 0.25
		tell menu bar item "Tools" of menu bar 1
			click
			click menu item "Database Design Report..." of menu 1
		end tell
		
		delay 0.25
		
		click radio button "XML 2 of 2" of window "Database Design Report"
		if (value of checkbox "Automatically open report when done" of window 1) = 1 then
			click checkbox "Automatically open report when done" of window 1
		end if
		delay 0.25
		
		click button "Create" of window 1
		
		delay 0.25
		keystroke "d" using {command down, shift down}
		delay 0.25
		click button "New Folder" of window 1
		delay 0.25
		keystroke folder_name
		delay 0.25
		click button "Create" of window 1
		
		delay 0.25
		click button "Save" of window 1
		
		return folder_name
	end tell
end tell