Hmm, strange - I will post the whole one in a minute, but above that, the excerpt in question... and yes, I had covered the "group should exist before you include it" by making any new groups first before going trough... I am a bit embarrassed, I haven't really looked into elegant ways to transfer a lot of data from Excel to Applescript, So I encode my cue information from the spreadsheed in this manner and use a variety of symbols to decode the information again in Applescript... talk about round-about fashion...:
lxCueNo-theWhen$theWhat-upTime/downTime%makeGroup/includeGroup1#includeGroup2#includeGroup3...
an example string straight from the press are these first few cues:
Code: Select all
0.1-p1, Q 0.1 # *Ready for* LX + SND Checks$LX Checks, House LX off-5/5%/;0.3-p, # $Technical Cue: Strike all movers and Set to appropriate position-1/1%0.3/0.3;0.5-p, # $Technical Cue: Douse all movers-1/1%0.5/0.3#0.5;0.9-p1, Q 0.9 # *Finish* LX + SND Checks$LX out, House LX on-5/5%/;1-p1, Q 1 # *Preshow*$30% BLUE BACKLIGHT + HOUSE LX-5/5%1/0.3#0.5#1;2-p1, Q 2 # *FoH Clearance*$HOUSE LIGHTS AND PRE SHOW STATE DOWN (BLACKOUT)-5/6%2/0.3#0.5#2
Here the snippet that counts:
Code: Select all
--record the cue
set theDoCommand to "record!: " & (cueNo as text)
my execLXC(theDoCommand)
--potentially include group(s)
-- make sure we are still in live
my modeLXC("live")
-- if theIncludedGroups is not "" then
set AppleScript's text item delimiters to "#"
try
set the item_list20 to every text item of theIncludedGroups
set AppleScript's text item delimiters to ""
on error testtt20
display dialog testtt20
end try
repeat with eachIncludedGroup in item_list20
if eachIncludedGroup is not "" then
set theDoCommand to "Group: " & (eachIncludedGroup as text)
my execLXC(theDoCommand)
end if
end repeat
In this bit, if I change "Group: " to "Group!: ", the group inclusion does not work, though no error is spat. I had briefly tried adding delays, thinking that maybe LXConsole did not react fast enough to have the cues there before they were included, but it does not seem like this is the issue...
Here for all suicidals, the full script:
Code: Select all
-- GENERATE DEPENDENT GROUP CUE V1
-- Select 2 or more channels (usually, an odd number looks nicer) in the order that you would like the fan to be applied,
-- and exectute script to create smooth static fans and chases
property alphaList : "abcdefghijklmnopqrstuvwxyz"'s items & reverse of "ABCDEFGHIJKLMNOPQRSTUVWXYZ"'s items
set tid to AppleScript's text item delimiters
try
tell application "LXConsole"
set i to 1
repeat while i = 1
set creationResults to ""
set newLXQtxtPre to text returned of (display dialog "Please enter LX Cue number(s) encoded, seperated by semicola, hyphen to specify items:" default answer "")
--- enumeration
set AppleScript's text item delimiters to ";"
try
set the item_list to every text item of newLXQtxtPre
set AppleScript's text item delimiters to ""
on error testtt3
display dialog testtt3
end try
repeat with eachPotentialTupel in item_list
set AppleScript's text item delimiters to "-"
try
set the item_list2 to every text item of eachPotentialTupel
--lxCueNo-pageNo, qLabCueNo # cuePoint $cueDescription-upTime/downTime%makeGroup/includeGroup1#includeGroup2#includeGroup3...
set AppleScript's text item delimiters to ""
set theMakeGroup to ""
set theIncludeGroups to ""
set upDownTimes to "0/0"
set lxCue to first item of item_list2
set lxNotes to second item of item_list2
set upDownTimesAndGroups to last item of item_list2
-- separating times from groups
set AppleScript's text item delimiters to "%"
try
set the item_list10 to every text item of upDownTimesAndGroups
set AppleScript's text item delimiters to ""
set x to 0
set upDownTimes to first item of item_list10
set theGroups to last item of item_list10
on error testtt13
display dialog "Bla13" & testtt13
end try
-- separating Makes from Includes of groups
set AppleScript's text item delimiters to "/"
try
set the item_list11 to every text item of theGroups
set AppleScript's text item delimiters to ""
set x to 0
set theMakeGroupO to first item of item_list11
set theIncludeGroupsO to last item of item_list11
on error testtt7
display dialog "Bla7" & testtt7
end try
-- separating up from down times
set AppleScript's text item delimiters to "/"
try
set the item_list9 to every text item of upDownTimes
set AppleScript's text item delimiters to ""
set x to 0
set theUpTimeO to first item of item_list9
set theDownTimeO to last item of item_list9
on error testtt6
display dialog testtt6
end try
-- separating cuePt from Description
set AppleScript's text item delimiters to "$"
try
set the item_list8 to every text item of lxNotes
set AppleScript's text item delimiters to ""
set x to 0
set theWhenO to first item of item_list8
set theWhatO to last item of item_list8
if theWhen is theWhatO then
set theWhatO to ""
end if
on error testtt5
-- display dialog testtt5
end try
--- bolding cue points
set AppleScript's text item delimiters to "*"
try
set the item_list7 to every text item of theWhenO
set AppleScript's text item delimiters to ""
set x to 0
set theWhenO to ""
repeat with eachTextPart in item_list7
set eachTxtPt to eachTextPart as text
set x to x + 1
if x mod 2 is 0 then
set eachTxtPt to "__" & (my changeCase(eachTxtPt, "upper")) & "__"
end if
set theWhenO to theWhenO & eachTxtPt
end repeat
on error testtt4
display dialog testtt4
end try
on error testtt4
display dialog testtt4
end try
-- INSERT HERE
my writeCue(lxCue, theWhatO, theWhenO, theMakeGroupO, theIncludeGroupsO, theUpTimeO, theDownTimeO)
-- my setWhat(10, "Bla")
--set theDoCommand to "record: 10"
--my execLXC(theDoCommand)
end repeat
set i to 0
end repeat
end tell
on error errMsg number errorNumber
if the errorNumber is equal to 666 then
display dialog "Oops, somewhat illegal character in channel selection… I can't understand: " & thisCharacter
else
display dialog ("An unknown error occurred: " & errorNumber as text) & errMsg
end if
set AppleScript's text item delimiters to tid
end try
on convertCueNo(this_text)
set newLXQtxt to my replace_chars(this_text, ".", ",")
set newLXQtxt2 to my replace_chars(this_text, ",", ".")
try
set this_num to newLXQtxt2 as number
on error testtt1
try
set this_num to newLXQtxt as number
on error testtt2
display dialog testtt1 & testtt2
end try
end try
return this_num
end convertCueNo
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
on textItems from t
try
t's text items
on error number -2706
tell (count t's text items) div 2 to my (textItems from (t's text 1 thru text item it)) & my (textItems from (t's text from text item (it + 1) to -1))
end try
end textItems
on changeCase(t, c)
if (count t) is 0 then return t
considering case
if c is not in {"upper", "lower", "title", "sentence"} then
error "The word \"" & c & "\" is not a valid option. Please use \"upper\", \"lower\", \"title\" or \"sentence\"."
else if c is "upper" then
set n to 1
else
set n to -1
end if
set d to text item delimiters
repeat with n from n to n * 26 by n
set text item delimiters to my alphaList's item n
set t to textItems from t
set text item delimiters to my alphaList's item -n
tell t to set t to beginning & ({""} & rest)
end repeat
if c is in {"title", "sentence"} then
if c is "title" then
set s to space
else
set s to ". "
end if
set t to (t's item 1 & s & t)'s text 2 thru -1
repeat with i in {s, tab, return, ASCII character 10}
set text item delimiters to i
if (count t's text items) > 1 then repeat with n from 1 to 26
set text item delimiters to i & my alphaList's item n
if (count t's text items) > 1 then
set t to textItems from t
set text item delimiters to i & my alphaList's item -n
tell t to set t to beginning & ({""} & rest)
end if
end repeat
end repeat
set t to t's text ((count s) + 1) thru -1
end if
set text item delimiters to d
end considering
return t
end changeCase
on twoDigits(intensity)
if intensity < 10 then
return "0" & (intensity as text)
else
return (intensity as text)
end if
end twoDigits
on writeCue(cueNo, theWhat, theWhen, theMakeGroup, theIncludedGroups, theUpTime, theDownTime)
(* display dialog "LX Cue No: " & cueNo & "
Make Group No: " & theMakeGroup & "
Included Group Nos: " & theIncludedGroups & "
Up time: " & theUpTime & "
Down time: " & theDownTime & "
The What: " & theWhat & "
The When: " & theWhen
*)
my modeLXC("live")
--potentially make group
if theMakeGroup is not "" then
set theDoCommand to "record group!: " & (theMakeGroup as text)
my execLXC(theDoCommand)
my modeLXC("live")
end if
--record the cue
set theDoCommand to "record!: " & (cueNo as text)
my execLXC(theDoCommand)
--potentially include group(s)
-- make sure we are still in live
my modeLXC("live")
-- if theIncludedGroups is not "" then
set AppleScript's text item delimiters to "#"
try
set the item_list20 to every text item of theIncludedGroups
set AppleScript's text item delimiters to ""
on error testtt20
display dialog testtt20
end try
repeat with eachIncludedGroup in item_list20
if eachIncludedGroup is not "" then
set theDoCommand to "Group: " & (eachIncludedGroup as text)
my execLXC(theDoCommand)
end if
end repeat
-- end if
--set theWhat, theWhen and times
tell application "LXConsole"
tell the front document
-- display dialog the when of currentCue as text
set theCue to currentCue
-- display dialog (cueNumber of theCue) as text
if theWhat is "" then set theWhat to " "
if theWhen is "" then set theWhen to " "
if theUpTime is "" then set theUpTime to "5"
if theDownTime is "" then set theDownTime to theUpTime
set the what of theCue to (theWhat as text)
set the when of theCue to (theWhen as text)
set the upTime of theCue to (theUpTime as real)
set the downTime of theCue to (theDownTime as real)
end tell
end tell
end writeCue
on execLXC(theDoCommand)
tell application "LXConsole"
if the front document exists then
activate
tell the front document to doCommand string theDoCommand
-- display dialog theDoCommand as text
end if
end tell
end execLXC
on modeLXC(theMode)
-- display dialog theMode as text
tell application "LXConsole"
if the front document exists then
activate
setMode the front document to (theMode as text)
end if
end tell
end modeLXC
There is probably still some tidying up for me to do, but my sore thumb has proven that it works like a treat (after acknowledging stupid amounts of Group Includes
...
Thanks for checking up on this
!