2014-09-20 4 views
-3

내 친구를 시도하기 위해 가짜 바이러스를 만들었습니다 : P하지만 응용 프로그램이 끝날 때까지 명령 옵션 이스케이프 기능을 사용하지 못하도록하는 코드가 있는지 궁금합니다. 나는 단지 그들이 실험을 완전히 끝내지 않고 그 과정을 경험하기를 원한다. 감사합니다거기에 애플 스크립트 응용 프로그램이 실행되는 동안 강제로 종료 할 수 없게하는 방법이 있습니까?

: 그것은 내가 내 친구를 표시 할 수 있지만, 난 그냥 처음 몇 초 후를 강제 종료하고 싶지 않았다 생각 그냥 간단한 스크립트의 편집 -, 그들은 여전히 ​​맥을 완벽하게 제어 할 수

표시 대화 상자가 버튼 결과의 반환 버튼을

세트 볼륨 5

경고음 5

후 "재생"인 경우 기본 버튼 1 을 { "종료", "재생"} "MagroXELA의 게임을"
display dialog "Virus is downloading." buttons "Stop" default button "Stop" with title "Malware Initiating" with icon 2 
delay 2 
set volume 5 
do shell script "say -v Zarvox Virus has Down loaded Successfully" 
delay 2 
do shell script "say -v Zarvox Wifi terminated" 
beep 1 
-- 
-- Toggle Airport Power On and Off 
-- 
if (offset of "On" in (do shell script "networksetup -getairportpower en1")) > 0 then 
    do shell script "networksetup -setairportpower en1 off" 

end if 

tell application "Finder" 
    activate 
    open application file "Activity Monitor.app" of folder "Utilities" of folder "Applications" of startup disk 
    open application file "AirPort Utility.app" of folder "Utilities" of folder "Applications" of startup disk 
    open application file "Boot Camp Assistant.app" of folder "Utilities" of folder "Applications" of startup disk 
    open application file "Bluetooth File Exchange.app" of folder "Utilities" of folder "Applications" of startup disk 
    open application file "Disk Utility.app" of folder "Utilities" of folder "Applications" of startup disk 
    open application file "Keychain Access.app" of folder "Utilities" of folder "Applications" of startup disk 
    open application file "Terminal.app" of folder "Utilities" of folder "Applications" of startup disk 
    open application file "System Information.app" of folder "Utilities" of folder "Applications" of startup disk 
end tell 


tell application "Finder" 
    activate 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    make new Finder window 
    set target of Finder window 1 to startup disk 
    set target of Finder window 1 to startup disk 
    open application file "Terminal.app" of folder "Utilities" of folder "Applications" of startup disk 
    set target of Finder window 1 to startup disk 
    set target of Finder window 1 to folder "Applications" of startup disk 
end tell 

delay 6 
tell application "DigitalColor Meter" to quit 
tell application "Grab" to quit 
tell application "Network Utility" to quit 
tell application "System Information" to quit 
tell application "Terminal" to quit 
tell application "Keychain Access" to quit 
tell application "Disk Utility" to quit 
tell application "Bluetooth File Exchange" to quit 
tell application "Boot Camp Assistant" to quit 
tell application "AirPort Utility" to quit 
tell application "Activity Monitor" to quit 
tell application "App Store" to quit 
tell application "iTunes" to quit 
tell application "Finder" 
    repeat while window 1 exists 
     close window 1 
    end repeat 
    delay 2 
    set volume 5 
    do shell script "say -v Alex YOU GOT TROLLED HUH HUH HUH HUH" 
    delay 2 
    do shell script "say -v Zarvox Wifi activated" 

    -- 
    -- Toggle Airport Power On and Off 
    -- 
    if (offset of "On" in (do shell script "networksetup -getairportpower en1")) > 0 then 
     do shell script "networksetup -setairportpower en1 off" 
    else 
     do shell script "networksetup -setairportpower en1 on" 
    end if 
    delay 4 
+1

우리는 확실히 통제를 다시 얻고에서 당신이 누군가를 방지 도움이되지 않습니다 (당신이 애플 스크립트 편집기에서 응용 프로그램을 열면 스크립트 편집기의 Info.plist보다 우선하기 때문에 모든 저장에이 단계를 반복해야)

자신의 컴퓨터. 왜 우리는 당신이 당신의 친구에게주는 무해한 대본이라고 믿어야합니까? – idmean

+0

나는 그것이 무엇을하는지 보여주는 스크립트를 게시했다. 강제 종료를 비활성화하거나 강제 종료 메뉴에서 응용 프로그램을 숨기는 스크립트가있을 것이라고 생각했다. 나는 그들이 컴퓨터를 제어 할 수 없도록하고자한다. –

+0

실제로 이것을 달성 할 수있는 방법이있다. 게시 한 스크립트가 매우 위험한 것은 아니지만 다른 악의적 인 스크립트를 위해 내가 제공 한 정보를 사용할 수 있습니다. 그리고 여러 대의 애플 리케이션과 여러 창을 열 때 맥을 제어 할 수 없게된다. – idmean

답변

3

당신은 이런 식으로 할 수도 있습니다 :

  1. 스크립트를 저장 어디서나 Mac에서 응용 프로그램 (파일> 저장 파일 형식 응용 프로그램으로 선택) 등. 그런 다음 AppleScript 편집기를 닫으십시오.

  2. 그런 다음 Finder에서 응용 프로그램으로 이동 오른쪽을 클릭하고 Show Package Contents

  3. 표시됩니다 디렉토리 Contents을 포함하는 디렉토리를 선택합니다. 이 폴더 안에는 Info.plist

  4. 등의 파일이 있습니다.이 파일을 원하는 텍스트 편집기 (예 : 텍스트 편집기)로 엽니 다.

    <key>LSBackgroundOnly</key> 
    <true/> 
    

    그래서 파일의 마지막 네 줄은 다음과 같이 찾고 있습니다 :

    <key>LSBackgroundOnly</key> 
        <true/> 
    </dict> 
    </plist> 
    

그런 다음</dict> 마지막 전에 파일 의 끝 부분에이 코드를 추가

파일을 저장하면 준비가 완료됩니다. 텍스트 편집기를 닫고 응용 프로그램을 두 번 클릭 할 수 있습니다.

이 속성을 사용하면 OS X에서 백그라운드 프로세스로 앱을 실행하고 백그라운드 프로세스가 Dock에 표시되지 않고 강제 종료 윈도우에 표시되지 않습니다.물론 Activity Monitor를 사용하여 애플리케이션을 강제 종료 할 수 있습니다.

이 속성은 display dialog 또는 choose folder과 같은 사용자 상호 작용을 허용하지 않습니다.

+0

음, 방금 LSUIelement 대신 도움을 주셔서 감사합니다. Btw 당신은 "이 속성이 표시 대화 상자 또는 폴더 선택과 같은 사용자 상호 작용을 허용하지 않는다는 것을 알고 있어야합니다."라는 의미는 무엇입니까? LSBackground와 LSUIelement는 비슷하지만 디스플레이 대화 상자를 볼 수 있고 버튼을 클릭 할 수 있습니다. –

+0

@AlexDylanMagri AppleScript는 때때로 내가 의미했던 대화 상자를 표시 할 때 "UI not allowed"이라는 메시지로 앱을 종료합니다. 내 또는 모든 대답이 귀하의 질문을 해결 한 경우 체크 표시를 클릭하여 [동의 함] (http://meta.stackexchange.com/q/5234/179419)을 고려하십시오. 이는 해결책을 찾았으며 응답자와 자신에게 어느 정도의 평판을 제공한다는 것을 더 넓은 커뮤니티에 나타냅니다. 이를 수행 할 의무는 없습니다. – idmean

+0

괜찮 았어, 나는 다른 사람들이 유용하다고 생각할 것이기 때문에 나는 체크 표시를 클릭했다. 고맙습니다. 이 사이트의 새로운 기능 –

1

명령 줄 도구 "osascript"를 사용하여 모든 AppleScript 코드를 실행할 수 있습니다. 실행중인 명령 행 도구는 강제 종료 메뉴에 나타나지 않으므로이 방법이 유용합니다. 예를 들어 이것이 당신의 애플 스크립트라고 가정 해 보겠습니다.

tell application "TextEdit" to activate 
delay 5 
tell application "TextEdit" to quit 

다음은 osascript를 사용하여 실행하는 방법입니다.

set theCode to "tell application \"TextEdit\" to activate 
delay 5 
tell application \"TextEdit\" to quit" 

do shell script "echo " & quoted form of theCode & " | osascript > /dev/null 2>&1 &" 

기본적으로 당신이해야 할 일은 애플 스크립트 코드를 텍스트로 변환 한 다음 그림과 같이 osascript로 보내면됩니다.

행운을 빈다.

+0

나는 그것을 시험해 볼 것이다. 고마워 :) –