Automate live text copy from Mac preview in image

I have bunch of images in a folder where I'm trying to copy live text from each image and paste it in text file I am trying to use AppleScript to open image in Preview->Text selection-> Command + a but its not selecting live text its just selecting image. I am open to using any swift script to suggest me how to process my images to get live text. Thanks.

Apple script

tell application "Finder"
	set fl to files of folder POSIX file "/Users/Data" as alias list

end tell

repeat with f in fl
	tell application "Preview"
		activate
		open f
		tell application "System Events"
			tell its process "Preview"
				click menu item "Text Selection" of menu "Tools" of menu bar 1
			end tell
		end tell
		delay 5
		tell application "System Events"
			tell application process "Preview"
				click at {100, 200}
				delay 2
				keystroke "a" using command down
				delay 1
			end tell
		end tell
		delay 30
		repeat until (count of windows) > 0
		delay 2.0
		end repeat
	close front document

	end tell

end repeat

Automate live text copy from Mac preview in image
 
 
Q