Reputation: 548
I am trying to start and hide quicktime player, start recording my iPhone screen for some duration and save the output on the desktop with file name "hello" with the below script
on run
set filePath to (path to desktop as text) & "hello.mov"
set f to a reference to file filePath
startVideoRecording(f)
end run
on startVideoRecording(f)
tell application "QuickTime Player"
activate
tell application "System Events"
keystroke "h" using command down
end tell
set newMovieRecording to new movie recording
set camera to "Prabhu Konchada's iPhone"
tell newMovieRecording
set camera to "Prabhu Konchada's iPhone"
start
end tell
delay (10)
pause
save newMovieRecording in f
stop
close newMovieRecording
end tell
end startVideoRecording
To hide quicktime player I tried :
tell application "Finder" set visible of process "QuickTime Player" to false end tell
tell application "System Events" set frontProcess to first process whose frontmost is true set visible of frontProcess to false end tell
The above 3 methods didn't serve my purpose and I don't want this quicktime all over my screen or visible in my DOCK ...
Upvotes: 3
Views: 8208
Reputation: 293
tell application "System Events"
set visible of application process "QuickTime Player" to false
end tell
Upvotes: 5
Reputation: 285270
set the bounds of the front window to an "impossible" value and delete the activate
line
on run
set filePath to (path to desktop as text) & "hello.mov"
set f to a reference to file filePath
startVideoRecording(f)
end run
on startVideoRecording(f)
tell application "QuickTime Player"
set newMovieRecording to new movie recording
set bounds of window 1 to {-3000, 0, 100, 100}
set camera to "Prabhu Konchada's iPhone"
tell newMovieRecording
set camera to "Prabhu Konchada's iPhone"
start
end tell
delay (10)
pause
save newMovieRecording in f
stop
close newMovieRecording
end tell
end startVideoRecording
Upvotes: 1