2013-06-03 2 views
0

편집 : AppleScript를 사용하여 웹 프록시 디버깅 App Charles (http://www.charlesproxy.com/)에서 세션 파일을 저장하려고합니다. 기본적으로 "내보내기"를 선택하고 임시 이름을 입력 한 다음 저장합니다. 그러나 "Format"영역 인 콤보 상자 2를 클릭 한 다음 "XML 세션 파일 (.xml)"팝업 버튼을 클릭하면 AppleScript 편집기에서 찾을 수 없다는 오류가 발생합니다. .Charles와 AppleScript (접근성 검사에서 누락 된 값)

다음 코드를 사용하여 해킹당한 순간이지만, AppleScript 편집기와 때로는 터미널/내 코드에서만 작동합니다. 특히 다른 작업을 동시에 수행 할 때 더욱 그렇습니다.

tell application "Charles" 
    activate 
end tell 

tell application "System Events" 
    tell process "Charles" 
     tell menu bar 1 
      click menu bar item "File" 
      tell menu "File" 
       click menu item "Export..." 
      end tell 
     end tell 
     tell window "Save" 
      keystroke "tempCharles" 
      delay 0.5 
      click combo box 2 
      delay 0.5 
      key code 125 -- down arrow 
      delay 0.2 
      key code 125 
      delay 0.2 
      key code 125 
      delay 0.2 
      key code 125 
      delay 0.2 
      keystroke return 
      delay 0.4 
      keystroke return 
      delay 0.4 
      keystroke return 
     end tell 
    end tell 
end tell 

나는 내 코드는 모든 해킹이 너무 괜찮이

tell window "Save" 
     keystroke "tempCharles.xml" 
     delay 3 
     click combo box 2 
     tell combo box 2 
      click pop up button "XML Session File (.xml)" 
     end tell 
     click button "Save" 
    end tell 

같은 것을보고 싶다. 게시하기 전에 터미널에서 "osascript"를 실행하여 AppleScript 편집기를 통해 작동하지 않는지 확인하십시오.

답변

0

set value of text field 1 of window 1 중 하나가 작동하는 것 같지 않았어요,하지만 당신은 단지 keystroke를 사용하여 시도 할 수 : 일

delay 0.5 -- time to release modifier keys if the script is run with a shortcut like cmd-R 
tell application "System Events" to tell process "Charles" 
    set frontmost to true 
    click menu item "Save..." of menu 1 of menu bar item "File" of menu bar 1 
    keystroke "templog" & return 
end tell 
0

네! 방금 추가했습니다

-- Got rid of the "set text" line 
keystroke return 
delay 1 
click button "Save" 

매우 미묘하고 이전에는 본 적이 있지만 지금은 무엇이 더 나은지 깨닫습니다. 고마워요!