FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

On/Off widget to Yes/No dialog widget

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


Joined: 08 Nov 2009
Posts: 1

PostPosted: Sun Nov 08, 2009 9:17 am    Post subject: On/Off widget to Yes/No dialog widget Reply with quote

I'm building a script to toggle Caffeine on or off.

Using the templates, when the script is ran it follows the On/Off Switch Widget. What I want to do is when the value is true (On is selected), run a new text dialog to ask if the user wants to set a time duration, else turn on Caffeine indefinately. If yes, input the time duration of Caffeine in a text prompt.

However simply putting the template for the Yes/No widget into a if statement gives an error about the on statement. Placing it outside the on "[color=green]process dialog ok the_dialog[/color]" command gives a repeat error for the "[color=green]on process dialog ok set_time[/color]". Here's the code so far

[color=green]using terms from application "SEC Helper"

on process invoke a_terminal
tell a_terminal
set the_widget to make new boolean switch dialog with properties {title:"Caffeine", value:true}
push the_widget
end tell
end process invoke

on process dialog ok the_dialog
if value of the_dialog is true then
tell a_terminal
set set_time to make new question dialog
set textual content of set_time to "Set activation time?"
push set_time
end tell

on process dialog ok set_time
--Enter text prompt code here
end process dialog ok

on process dialog cancel set_time
tell application "Caffeine" to turn on
end process dialog cancel

show screen message "Caffeine On"
end if

if value of the_dialog is false then
tell application "Caffeine" to turn off
show screen message "Caffeine Off"
end if

end process dialog ok

on process dialog cancel the_dialog
show screen message "cancelled"
end process dialog cancel
end using terms from[/color]

Should I build separate scripts? If so how would you call one script from within this one?
Back to top
View user's profile Send private message Visit poster's website
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