⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 15 - talking to applescript to get user input.rb

📁 O Reilly Ruby Cookbook source code
💻 RB
字号:
require 'rubygems'require 'applescript'name = AppleScript.gets("What's your name?")AppleScript.puts("Thank you!")choice = AppleScript.choose("So which of these is your name?",                             ["Leonard", "Mike", "Lucas", name])if name == choice  AppleScript.say "You are right!"  picture = AppleScript.choose_file("Find a picture of yourself")  if File.exists?(picture)    AppleScript.say "Thanks, I will now post it on Flickr for you."    # Exercise for the reader: upload the file to Flickr  endelse  AppleScript.say "But you just said your name was #{name}!"end#---script = 'tell application "Finder" to display dialog "Hello World!" ' +         'buttons {"OK"}'AppleScript.execute(script)#---

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -