update to QDisplay

152 views
Skip to first unread message

Chris Ashworth

unread,
Jan 21, 2016, 11:23:13 AM1/21/16
to ql...@googlegroups.com, mathia...@hotmail.com
Thanks to Mathias Halén for submitting an update to QDisplay, which now allows you to set the font size and font color via AppleScript.

You can find an updated pre-built binary linked on the project page here:


Thanks Mathias!

-Chris

Message has been deleted

nizer

unread,
Jan 22, 2016, 10:05:29 AM1/22/16
to QLab, mathia...@hotmail.com
Is there a way to have time remaining also be part of the text color and size.

This…

tell application "QDisplay"
set timeRemaining to 60
set message to "Showtime in..." & timeRemaining
set messageSize to 50
set messageColor to "red"
end tell

Produces this… (with the red text static and the small white text counting down).
(see attached) 

Screen Shot 2016-01-22 at 10.02.18 AM.png

Waschfeld, Maik

unread,
Jan 22, 2016, 10:24:29 AM1/22/16
to QLab

Hi Team,

 

And:

>set messageColor to ““

 

produces an AppleScript-error “-609”, as text: “Connection not allowed. (?)”  and a full breakdown of QDisplay.

I assumed, it would reset the color to a default setting.

 

 

Regards…

 

…Maik Waschfeld

Chris Ashworth

unread,
Jan 22, 2016, 10:57:18 AM1/22/16
to Waschfeld, Maik, ql...@googlegroups.com
Nope! It doesn’t. :-)

Feel free to submit a pull request on github ;-)

nizer

unread,
Jan 22, 2016, 1:04:20 PM1/22/16
to QLab, mathia...@hotmail.com
I got this from Mathias Halén via email. Great work around.

But you can use a AppleScript countdown/alarm I Created to make it look like this where the text change color depending on the current time is <= alarmTime.
Is it something what you can use?

tell application "QDisplay"


set alarmHour to 16
set alarmMinute to 0
set messageSize to 80
set messageString to "Put your text here...."


repeat
set theDate to the current date
set the hours of theDate to alarmHour
set the minutes of theDate to alarmMinute
set the seconds of theDate to 0
theDate


set countdown to (current date) - theDate
set ss to countdown mod 60
if (current date) > theDate then
set mm to round (countdown / 60) mod 60 rounding down
set hh to round (countdown / 3600) rounding down
else
set mm to round (countdown / 60) mod 60 rounding up
set hh to round (countdown / 3600) rounding up
end if




-- If Current Date is > theDate
if (current date) > theDate then
set messageColor to "red"
if hh < 10 then
set hh to "+" & 0 & hh
else
set hh to "+" & hh
end if
if mm < 10 then
set mm to 0 & mm
else
set mm to mm
end if
if ss < 10 then
set ss to 0 & ss
else
set ss to ss
end if
else
set messageColor to "white"


if hh < 0 then
set hh to (hh * -1)
end if


if mm < 0 then
set mm to (mm * -1)
end if
if ss < 0 then
set ss to (ss * -1)
end if



if hh < 10 then
set hh to "-" & 0 & hh
else
set hh to "-" & hh
end if
if mm < 10 then
set mm to 0 & mm
else
set mm to mm
end if
if ss < 10 then
set ss to 0 & ss
else
set ss to ss
end if


end if










set countDownString to hh & ":" & mm & ":" & ss


set message to messageString & "
" & countDownString as string
end repeat
end tell

 

mathias halén

unread,
Jan 22, 2016, 3:27:23 PM1/22/16
to QLab
At this point you can just use

set messageColor to "black"

set messageColor to "white"


set messageColor to "red"

set messageColor to "green"

set messageColor to "blue"


set messageColor to "cyan"

set messageColor to "magenta"

set messageColor to "yellow"


and the color name must all be in lowcap with "". So to set it to default use set messageColor to "white"


// Mathias

Rich Walsh

unread,
Jan 22, 2016, 4:14:40 PM1/22/16
to ql...@googlegroups.com
This runs up 3 of my 8 cores to 100% when I test it in AppleScript Editor!

Can't you just use a Titles Cue with a 1s loop in QLab to do a countdown: https://groups.google.com/d/topic/qlab/sSj7JCeOvYs/discussion?

Rich

--
--
Change your preferences or unsubscribe here:
http://groups.google.com/group/qlab
 
Follow Figure 53 on Twitter: http://twitter.com/Figure53
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/9539233b-b5c6-4675-9d4e-425bfb9c7ac6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

mathias halén

unread,
Jan 22, 2016, 4:57:13 PM1/22/16
to QLab
Add a delay just above the 
end repeat
and this should be much easier on our core.

Rich Walsh

unread,
Jan 22, 2016, 5:50:18 PM1/22/16
to ql...@googlegroups.com
On 22 Jan 2016, at 21:57, mathias halén <mathia...@gmail.com> wrote:

Add a delay just above the 
end repeat
and this should be much easier on our core.

I wondered if I could fix it by tidying up the code, but actually a small delay makes it hardly register on the processor:

-- NB: this script loops indefinitely; you need to implement it in such a way that you can stop it!

-- Declarations

set userAlarmTime to "19:30:00" -- Time format subject to localisation settings

set userMessageString to "Time to alarm…"
set userTextDelimiter to return -- What should go between the userMessageString and the countdown, eg: space, return

set userBeforeColour to item 2 of availableColours -- Colour of message before alarm
set userAfterColour to item 3 of availableColours -- Colour of message after alarm

set userMessageSize to 48

property availableColours : {"black", "white", "red", "green", "blue", "cyan", "magenta", "yellow"} -- All colours in QDisplay

-- Main routine

set alarmTime to date userAlarmTime of (current date) -- Asking for current date inside a tell block adds overhead (error -10004)

tell application "QDisplay"
set messageSize to userMessageSize
set messageColor to userBeforeColour
end tell

set colourChanged to false

repeat


set secondsRemaining to alarmTime - (current date)


if secondsRemaining > 0 then
set timeString to "-" & my makeHHMMSS(secondsRemaining)
else
set timeString to "+" & my makeHHMMSS(-secondsRemaining)
if not colourChanged then
tell application "QDisplay" to set messageColor to userAfterColour
set colourChanged to true
end if
end if


tell application "QDisplay" to set message to userMessageString & userTextDelimiter & timeString


delay 0.5 -- Less than 1 second allows the counter to get closer to realtime


end repeat

-- Subroutines

on makeHHMMSS(howLong)
set howManyHours to howLong div 3600
set howManyMinutes to howLong mod 3600 div 60
set howManySeconds to howLong mod 60 div 1
return padNumber(howManyHours, 2) & ":" & padNumber(howManyMinutes, 2) & ":" & padNumber(howManySeconds, 2)
end makeHHMMSS

on padNumber(theNumber, minimumDigits)
set paddedNumber to theNumber as text
repeat while (count paddedNumber) < minimumDigits
set paddedNumber to "0" & paddedNumber
end repeat
return paddedNumber
end padNumber

Hopefully there's some useful methods in there that can be extrapolated to any kind of time string manipulation…

I haven't tested it beyond proving it basically works, I think.

Rich
Reply all
Reply to author
Forward
0 new messages