代码之家  ›  专栏  ›  技术社区  ›  tig Charlie Martin

AppleScript一行程序

  •  0
  • tig Charlie Martin  · 技术社区  · 14 年前

    是否可以将applescript行连接成一行(在ruby中,可以使用 ; )?

    4 回复  |  直到 8 年前
        1
  •  6
  •   Philip Regan    14 年前

    if-then

    if (variable) then 
        return true
    end if
    

    if (variable) then return true
    

    osascript -e

    osascript -e 'if (variable) then' -e 'return true' -e 'end if'
    

        2
  •  3
  •   smizzlov    9 年前

    tell application "System Preferences"
        activate
    end tell
    
    tell application "System Events"
        tell application process "System Preferences"
            tell window "System Preferences"
                tell scroll area 1
                    tell button "General"
                        click
                    end tell
                end tell
            end tell
        end tell
    end tell
    

    tell application "System Preferences" to activate
    tell application "System Events" to tell application process "System Preferences" to tell window "System Preferences" to tell scroll area 1 to tell button "General" to click
    
        3
  •  0
  •   Alec Jacobson    10 年前

    -e echo

    osascript -e "`echo -e \"tell application \\"MyApp\\"\nactivate\nend tell\"`"
    

    " \\" \n

        4
  •  0
  •   Pysis    8 年前

    tell application <application>
      activate
      open location <url>
    end tell
    

    osascript -e "tell application \"<application>\" to activate & open location \"<url>\"";