InDesign - Document Dictionary's Spelling Set to Hunspell

Does anybody know if it is possible to change an InDesign CC document’s preference so its Dictionary setting is changed from Proximity to Hunspell? My goal is to achieve this switch without invoking any dialogs, but I do not believe there is a way?

Thanks in advance,
-Jeff

Hi
I went for a nosey to see if I could find something in pure AppleScript but couldn’t, what I did
find however is something that may be wrapped in AppleScript, however, I have no idea as I don’t no javascript

This web site has a script that you can down load called “Setup”, it sets all of Indesign’s prefs etc and part of that
is the dictionery area which sets the area your looking for, could be worth a look?

http://www.gilbertconsulting.com/resources-scripts.html

// Preferences : Dictionary
		myDoc.textDefaults.appliedLanguage = "English: USA";
		app.languagesWithVendors.itemByName('English: USA').addDictionaryPath(File('~/Library/Application Support/Adobe/Linguistics/UserDictionaries/Adobe Custom Dictionary/en_US'));
		var fullPathOfUDC = "Macintosh HD:Users:keithgilbert:Dropbox:Templates:keith_indesign_dictionary.udc";  			  
		if (File(fullPathOfUDC).exists) {  
			var languages = app.languagesWithVendors.everyItem().getElements();    
			for (var n=0; n<languages.length; n++) {  
				if (languages[n].name == app.translateKeyString("$ID/English: USA")) {
					var result = languages[n].addDictionaryPath(fullPathOfUDC);  
					languages[n].hyphenationVendor = "Hunspell";
					languages[n].spellingVendor = "Hunspell";
					// languages[n].doubleQuotes = ;
					// languages[n].singleQuotes = ;
				}
			}
		} 

Thank you so much Budgie,
Your reply and script made me realize that what I was seeking was referred to as “spelling vendor”, which is a property of the language of the active document.

This script will change the active document’s Dictionary Spelling to Huspell instead of the default of Proximity.

Thank you once again!
-Jeff

tell application "Adobe InDesign CC 2017"
	tell active document
		set theLanguage to language "English: USA"
		tell theLanguage
			set spelling vendor to "Hunspell"
		end tell
	end tell
end tell

oh wow, nice, glad to have heleped