Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Chemical666

macrumors newbie
Original poster
May 5, 2014
2
0
Hi, I have an issue opening a file with applescript, The app is loaded but does not allow to open the type of file directly by double-clicking on it, it has to be opened through the menu bar and then "load configuration". Code works fine up to when comes the time to selct the actual file to open in the Finder "open" window that popped up. How do I specify to AppleScirpt how to go get the file I look for?

Here is the code I have so far for this part :

Code:
tell application "System Events"
	tell application process "JackPilot"
		click button "Routage" of window 1
		click menu item "Charger la configuration..." of menu 1 of menu bar item "Fichier" of menu bar 1
		get file of window 1  -- alias "Macintosh HD:Users:marc-andre:Desktop:test.jks" ""
	end tell
end tell

Thanks
 
Last edited:
Hi, I have an issue opening a file with applescript, The app is loaded but does not allow to open the type of file directly by double-clicking on it, it has to be opened through the menu bar and then "load configuration". Code works fine up to when comes the time to selct the actual file to open in the Finder "open" window that popped up. How do I specify to AppleScirpt how to go get the file I look for?

Here is the code I have so far for this part :

Code:
tell application "System Events"
	tell application process "JackPilot"
		click button "Routage" of window 1
		click menu item "Charger la configuration..." of menu 1 of menu bar item "Fichier" of menu bar 1
		get file of window 1  -- alias "Macintosh HD:Users:marc-andre:Desktop:test.jks" ""
	end tell
end tell

Thanks

You can try this :

Code:
set configurationFile to alias ((path to desktop folder as text) & "test.jks")
tell application "System Events"
	tell application process "JackPilot"
		click button "Routage" of window 1
		click menu item "Charger la configuration..." of menu 1 of menu bar item "Fichier" of menu bar 1
		--get file of window 1 -- alias "Macintosh HD:Users:marc-andre:Desktop:test.jks" ""
		keystroke "g" using {command down, shift down}
		delay 0.5
		keystroke configurationFile
		delay 0.5
		click button "what's on the button" of sheet 1 of window "title of window" -- or window 1 etc
		-- more statements
	end tell
end tell
 
Credits to kryten2, it worked! Thanks so much! For those who may encounter the issue, here is the final working code that I used :
Code:
tell application "System Events"
	set frontmost of process "JackPilot" to true
	tell application process "JackPilot"
		click button "Routage" of window 1
		click menu item "Charger la configuration..." of menu 1 of menu bar item "Fichier" of menu bar 1
		delay 1
		keystroke "g" using {command down, shift down}
		delay 0.5
		keystroke "Bureau"
		delay 0.5
		keystroke return
		delay 1.5
		keystroke "test.jks"
		keystroke return
	end tell
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.