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

arcobb

macrumors 6502
Original poster
Feb 3, 2005
250
5
Colorado
I am trying to write an applescript to automatically login to ProXPN on login. My script is close. Here is what I have:

Code:
launch application "proXPN"
delay 5
tell application "System Events" to tell process "proXPN"
    tell menu bar item 1 of menu bar 2
        click
    end tell
end tell

I would like to select the "Dallas 2, USA" server in the drop down list. Thank you for any help!
 

arcobb

macrumors 6502
Original poster
Feb 3, 2005
250
5
Colorado

Thanks! I got an Automator script to do what I what, although not as elegant as it could be. The links looks like a lot of learning for me, I rarely use apple script to spend a ton of time on them.

The script provided starts to work, it tries to open a menu item and then stops. I was hoping someone who knew applescript better then I could point out the error. The action I was looking for is ProXPN icon (on menu bar) -> connect -> Dallas 2, USA.

Thanks!
 

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
Thanks! I got an Automator script to do what I what, although not as elegant as it could be. The links looks like a lot of learning for me, I rarely use apple script to spend a ton of time on them.

The script provided starts to work, it tries to open a menu item and then stops. I was hoping someone who knew applescript better then I could point out the error. The action I was looking for is ProXPN icon (on menu bar) -> connect -> Dallas 2, USA.

Thanks!

Try this :

Code:
tell application "System Events"
	tell process "proXPN"
		tell menu bar item 1 of menu bar 2
			click
			if exists menu 1 then
				set menuItemConnect to click menu item "Connect" of menu 1
				if exists menu 1 of menuItemConnect then
					click menu item "Dallas 2, USA" of menu 1 of menuItemConnect
				end if
			end if
		end tell
	end tell
end tell
 

arcobb

macrumors 6502
Original poster
Feb 3, 2005
250
5
Colorado
Try this :

Code:
tell application "System Events"
	tell process "proXPN"
		tell menu bar item 1 of menu bar 2
			click
			if exists menu 1 then
				set menuItemConnect to click menu item "Connect" of menu 1
				if exists menu 1 of menuItemConnect then
					click menu item "Dallas 2, USA" of menu 1 of menuItemConnect
				end if
			end if
		end tell
	end tell
end tell


Thanks kryten2. It works!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.