Created
January 24, 2014 14:24
-
-
Save 2shortplanks/8598208 to your computer and use it in GitHub Desktop.
Example KeyboardMaestro script to play Guess My Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<array> | |
<dict> | |
<key>Activate</key> | |
<string>Normal</string> | |
<key>IsActive</key> | |
<true/> | |
<key>Macros</key> | |
<array> | |
<dict> | |
<key>Actions</key> | |
<array> | |
<dict> | |
<key>DisplayKind</key> | |
<string>Variable</string> | |
<key>IsActive</key> | |
<true/> | |
<key>IsDisclosed</key> | |
<true/> | |
<key>MacroActionType</key> | |
<string>ExecuteShellScript</string> | |
<key>Path</key> | |
<string></string> | |
<key>Text</key> | |
<string>#!/usr/bin/perl | |
print int(rand 100)+1</string> | |
<key>TimeOutAbortsMacro</key> | |
<true/> | |
<key>TrimResults</key> | |
<true/> | |
<key>TrimResultsNew</key> | |
<true/> | |
<key>UseText</key> | |
<true/> | |
<key>Variable</key> | |
<string>SecretNumber</string> | |
</dict> | |
<dict> | |
<key>IsActive</key> | |
<true/> | |
<key>IsDisclosed</key> | |
<true/> | |
<key>MacroActionType</key> | |
<string>SetVariableToText</string> | |
<key>Text</key> | |
<string>Not yet</string> | |
<key>Variable</key> | |
<string>Guess</string> | |
</dict> | |
<dict> | |
<key>IsActive</key> | |
<true/> | |
<key>IsDisclosed</key> | |
<true/> | |
<key>MacroActionType</key> | |
<string>SetVariableToText</string> | |
<key>Text</key> | |
<string>This is your first guess</string> | |
<key>Variable</key> | |
<string>Feedback</string> | |
</dict> | |
<dict> | |
<key>Actions</key> | |
<array> | |
<dict> | |
<key>Buttons</key> | |
<array> | |
<dict> | |
<key>Button</key> | |
<string>Guess</string> | |
<key>Cancel</key> | |
<false/> | |
</dict> | |
<dict> | |
<key>Button</key> | |
<string>Give Up</string> | |
<key>Cancel</key> | |
<true/> | |
</dict> | |
</array> | |
<key>IsActive</key> | |
<true/> | |
<key>IsDisclosed</key> | |
<true/> | |
<key>MacroActionType</key> | |
<string>PromptForUserInput</string> | |
<key>Prompt</key> | |
<string>Guess my number between 1-100. %Variable%Feedback%</string> | |
<key>TimeOutAbortsMacro</key> | |
<true/> | |
<key>Title</key> | |
<string>Guess My Number</string> | |
<key>Variables</key> | |
<array> | |
<dict> | |
<key>Default</key> | |
<string></string> | |
<key>Variable</key> | |
<string>Guess</string> | |
</dict> | |
</array> | |
</dict> | |
<dict> | |
<key>DisplayKind</key> | |
<string>Variable</string> | |
<key>IsActive</key> | |
<true/> | |
<key>IsDisclosed</key> | |
<true/> | |
<key>MacroActionType</key> | |
<string>ExecuteShellScript</string> | |
<key>Path</key> | |
<string></string> | |
<key>Text</key> | |
<string>#!/usr/bin/perl | |
print "Your last guess was too " . ($ENV{KMVAR_Guess} < $ENV{KMVAR_SecretNumber} ? "low" : "high") | |
</string> | |
<key>TimeOutAbortsMacro</key> | |
<true/> | |
<key>TrimResults</key> | |
<true/> | |
<key>TrimResultsNew</key> | |
<true/> | |
<key>UseText</key> | |
<true/> | |
<key>Variable</key> | |
<string>Feedback</string> | |
</dict> | |
</array> | |
<key>Conditions</key> | |
<dict> | |
<key>ConditionList</key> | |
<array> | |
<dict> | |
<key>ConditionType</key> | |
<string>Variable</string> | |
<key>Variable</key> | |
<string>Guess</string> | |
<key>VariableConditionType</key> | |
<string>IsNot</string> | |
<key>VariableValue</key> | |
<string>%Variable%SecretNumber%</string> | |
</dict> | |
</array> | |
<key>ConditionListMatch</key> | |
<string>All</string> | |
</dict> | |
<key>IsActive</key> | |
<true/> | |
<key>IsDisclosed</key> | |
<true/> | |
<key>MacroActionType</key> | |
<string>While</string> | |
<key>TimeOutAbortsMacro</key> | |
<true/> | |
</dict> | |
<dict> | |
<key>Buttons</key> | |
<array> | |
<dict> | |
<key>Button</key> | |
<string>Yey!</string> | |
<key>Cancel</key> | |
<true/> | |
</dict> | |
</array> | |
<key>IsActive</key> | |
<true/> | |
<key>IsDisclosed</key> | |
<true/> | |
<key>MacroActionType</key> | |
<string>PromptForUserInput</string> | |
<key>Prompt</key> | |
<string>Yep, the secret number was %Variable%SecretNumber%</string> | |
<key>TimeOutAbortsMacro</key> | |
<true/> | |
<key>Title</key> | |
<string>You Win!</string> | |
<key>Variables</key> | |
<array/> | |
</dict> | |
</array> | |
<key>IsActive</key> | |
<true/> | |
<key>ModificationDate</key> | |
<real>412144980.25019097</real> | |
<key>Name</key> | |
<string>Guess My Number</string> | |
<key>Triggers</key> | |
<array/> | |
<key>UID</key> | |
<string>CC000EE6-7E77-4CF6-A8B8-500B5EDA1AA1</string> | |
</dict> | |
</array> | |
<key>Name</key> | |
<string>Games</string> | |
<key>UID</key> | |
<string>50CC3C66-6E19-4CC0-84B1-6FC06D1C048D</string> | |
</dict> | |
</array> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment