FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Photo Booth Script

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac
View previous topic :: View next topic  
Author Message
Pash91
Newbie


Joined: 16 Jun 2007
Posts: 4

PostPosted: Sat Jun 16, 2007 4:25 am    Post subject: Photo Booth Script Reply with quote

My god, that took a long time to brush up on my skills and realize that it's better to start a script from within Salling Clicker than just in Script Editor for testing. Here is a very preliminary version:
[code:1]
if my is_application_launched() then
my show_root_options()
else
tell application "SEC Helper" to enter boolean popup mode question "Launch Photo Booth?" affirmative response "open_app_response"
end if

on is_application_launched()
tell application "SEC Helper"
set the process_flag to check application availability "Photo Booth"
end tell
if the process_flag then
return true
end if
return false
end is_application_launched

on open_app_response(flag)
if flag is 1 then
tell application "Photo Booth" to launch
my show_root_options()
end if
end open_app_response
---
on show_root_options()
tell application "SEC Helper" to enter boolean popup mode question "Say Cheese?" affirmative response "cheese"
end show_root_options

on cheese(flag)
if flag is 1 then
tell application "Photo Booth" to activate
tell application "SEC Helper" to simulate keyboard charcode (ASCII number "t") modifiers {"command"}
else if flag is 0 then
end if
end cheese

[/code:1]

I'm currently still working on it, but I figured I'd put up a first draft of it. Enjoy
Back to top
View user's profile Send private message
Pash91
Newbie


Joined: 16 Jun 2007
Posts: 4

PostPosted: Sat Jun 16, 2007 4:35 am    Post subject: Reply with quote

Figured I'd post up a quick update. Now I need to figure out how to actually select the effects...
[code:1]
if my is_application_launched() then
my show_root_options()
else
tell application "SEC Helper" to enter boolean popup mode question "Launch Photo Booth?" affirmative response "open_app_response"
end if

on is_application_launched()
tell application "SEC Helper"
set the process_flag to check application availability "Photo Booth"
end tell
if the process_flag then
return true
end if
return false
end is_application_launched

on open_app_response(flag)
if flag is 1 then
tell application "Photo Booth" to launch
my show_root_options()
end if
end open_app_response
---
on show_root_options()
tell application "SEC Helper"
enter list mode title "Photo Booth Options" items {"Take picture", "Effects 1", "Effects 2"} item selected "root_option_was_selected"
end tell
end show_root_options

on root_option_was_selected(itemIndex)
tell application "Photo Booth" to activate
if itemIndex is equal to 1 then
activate application "Photo Booth"
tell application "System Events"
tell process "Photo Booth"
perform action "AXPress" of button 1 of group 1 of window "Photo Booth"
end tell
end tell
else if itemIndex is equal to 2 then
activate application "Photo Booth"
tell application "System Events"
tell process "Photo Booth"
perform action "AXPress" of button "1" of group 1 of window "Photo Booth"
end tell
end tell
else if itemIndex is equal to 3 then
activate application "Photo Booth"
tell application "System Events"
tell process "Photo Booth"
perform action "AXPress" of button "2" of group 1 of window "Photo Booth"
end tell
end tell
end if
my show_root_options()
end root_option_was_selected
[/code:1]
Back to top
View user's profile Send private message
Pash91
Newbie


Joined: 16 Jun 2007
Posts: 4

PostPosted: Sat Jun 16, 2007 8:32 am    Post subject: Reply with quote

Figured I'd put in a command to close Photo Booth. It won't bring you back to the main menu, that'll be for tomorrow:
[code:1]
if my is_application_launched() then
my show_root_options()
else
tell application "SEC Helper" to enter boolean popup mode question "Launch Photo Booth?" affirmative response "open_app_response"
end if

on is_application_launched()
tell application "SEC Helper"
set the process_flag to check application availability "Photo Booth"
end tell
if the process_flag then
return true
end if
return false
end is_application_launched

on open_app_response(flag)
if flag is 1 then
tell application "Photo Booth" to launch
my show_root_options()
end if
end open_app_response
---
on show_root_options()
tell application "SEC Helper"
enter list mode title "Photo Booth Options" items {"Take picture", "Effects 1", "Effects 2", "Close Photo Booth"} item selected "root_option_was_selected"
end tell
end show_root_options

on root_option_was_selected(itemIndex)
tell application "Photo Booth" to activate
if itemIndex is equal to 1 then
activate application "Photo Booth"
tell application "System Events"
tell process "Photo Booth"
perform action "AXPress" of button 1 of group 1 of window "Photo Booth"
end tell
end tell
else if itemIndex is equal to 2 then
activate application "Photo Booth"
tell application "System Events"
tell process "Photo Booth"
perform action "AXPress" of button "1" of group 1 of window "Photo Booth"
end tell
end tell
else if itemIndex is equal to 3 then
activate application "Photo Booth"
tell application "System Events"
tell process "Photo Booth"
perform action "AXPress" of button "2" of group 1 of window "Photo Booth"
end tell
end tell
else if itemIndex is equal to 4 then
activate application "Photo Booth"
tell application "SEC Helper" to simulate keyboard charcode (ASCII number "q") modifiers {"command"}
end if
my show_root_options()
end root_option_was_selected
[/code:1]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group