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

robot62155

macrumors member
Original poster
Jun 5, 2011
32
0
Hello! I am trying to script something that will type the address of a server into my Minecraft game. There is a text box, but when the script runs everything works except for the keystroke. Instead of typing in the words it says "Can't make "MCDisney.us" into type integer." Mcdisney.us is what I want it to type. This is the script. Can you please help me?

display dialog "Would you like to play MCDisney?" buttons {"Yes", "No"}
set button_r to the button returned of the result

if the button_r is "yes" then
tell application "Minecraft"
activate
end tell
delay 10
say "Please click on direct connect"
delay 5
tell "sytem events"
keystroke "MCdisney.us"
end tell
end if

if the button_r is "No" then
end if
 
Try this:

Code:
display dialog "Would you like to play MCDisney?" buttons {"Yes", "No"}
set button_r to the button returned of the result

if the button_r is "yes" then
	tell application "Minecraft"
		activate
	end tell
	delay 10
	say "Please click on direct connect"
	delay 5
	tell application "system events"
		keystroke "MCdisney.us"
	end tell
end if

if the button_r is "No" then
end if
 
I got it

I delayed the time between when I told the application "System events" and keystroked. Thanks for replying!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.