0
가능한 중복 :
How do I scroll to the top of a window using applescript?맥 OS X - 제어 다른 창
내가 맥 OS X 10.6에 다른 프로세스의 다른 창을 제어하려는.
예를 들어 Safari를 아래로 스크롤하고 싶습니다.
어떻게하면됩니까?
가능한 중복 :
How do I scroll to the top of a window using applescript?맥 OS X - 제어 다른 창
내가 맥 OS X 10.6에 다른 프로세스의 다른 창을 제어하려는.
예를 들어 Safari를 아래로 스크롤하고 싶습니다.
어떻게하면됩니까?
애플 스크립트 사파리의 페이지를 아래로 스크롤 할 수 있습니다 확인 :
How do I scroll to the top of a window using applescript?
스크립트 :
tell application "System Events"
tell application "Safari" to activate
delay 0.5
key code 119
end tell
단순히 NSAppleScript으로이 스크립트를 실행 :
NSAppleScript *scrollDownSafari = [[NSAppleScript alloc] initWithSource:@"tell application \"System Events\"\ntell application \"Safari\" to activate\ndelay 0.5\nkey code 119\nend tell"];
[scrollDownSafari executeAndReturnError:nil];
편집
,더 나은 읽을 수있는 코드는`동일하다 "ab`"`@를 @ "는"@ "B"를`:
NSString *script =
@"tell application \"System Events\"\n"
"tell application \"Safari\" to activate\n"
"delay 0.5\n"
"key code 119\n"
"end tell";
NSAppleScript *scrollDownSafari = [[NSAppleScript alloc] initWithSource:script];
[scrollDownSafari executeAndReturnError:nil];
당신은 문자열 연결을 사용하여 그 읽기 쉽게 만들 수 있습니다. –
동의 함 :)주의 : 첫 번째 줄만'@'을 필요로하지만 모든 줄에'@'를 사용할 수 있습니다. – Anne
Objective C를 사용하는 다른 솔루션이 있습니까? –