Invert channel

Questions and issues concerning LXConsole (MacOS)
Tarabini
Posts: 6
Joined: Wed Aug 18, 2021 12:21 pm

Invert channel

Postby Tarabini » Wed Aug 02, 2023 4:28 pm

Hi Claude.
I'm controlling some Wahlberg rails with LX. I did the programming in april but due to a complicated rigging, we had to turn 2 rails 180 degrees this time. Is it possible to invert a channel so I don't have to change the whole show?

Best regards,
Stefan

admin
Site Admin
Posts: 230
Joined: Mon Nov 20, 2017 4:31 pm

Re: Invert channel

Postby admin » Thu Aug 03, 2023 2:44 am

Do you mean newLevel = 100 - oldLevel?

If so, you could modify the built-in AppleScript "Switch Channel Levels" as follows. (Use LXConsole->Install Extras->Copy of Built-in AppleScripts and modify the "Switch Channel Levels" script or simply paste the following into a blank script in ScriptEditor.

Code: Select all

(*
   This script shows cycling through cues setting the level of a channel to 100 - the previous level of that channel
*)

repeat
   display dialog "Enter channel A:" default answer "" buttons {"Cancel", "OK"} default button 2
   set channel_a to (the text returned of the result as integer)
   if channel_a is not equal to 0 then exit repeat
end repeat


repeat
   display dialog "Low cue number: " default answer "" buttons {"Cancel", "OK"} default button 2
   set low_limit to (the text returned of the result as real)
   if low_limit is not equal to 0 then exit repeat
end repeat

repeat
   display dialog "High cue number: " default answer "" buttons {"Cancel", "OK"} default button 2
   set high_limit to (the text returned of the result as real)
   if high_limit is not equal to 0 then exit repeat
end repeat

if low_limit ≤ high_limit then
   
   tell application "LXConsole"
      
      set begin_cue to the front document getCue withNumber low_limit
      
      set OK_to_change to false
      
      if begin_cue is missing value then
         display dialog "Cue " & low_limit & " does not exist."
      else
         set OK_to_change to true
      end if
      
      set end_cue to the front document getCue withNumber high_limit
      
      if end_cue is missing value then
         display dialog "Cue " & end_cue & " does not exist."
      else
         set OK_to_change to true
      end if
      
      
      if OK_to_change is true then
         
         tell the front document to setMode to "cues"
         
         tell the front document to doCommand string "cue: " & low_limit --go to beginning
         
         set finished to false
         set is_beginning to true
         
         repeat until finished is true
            if is_beginning is not true then
               tell the front document to gotoNextCue
            else
               set is_beginning to false
            end if
            
            set _cue to currentCue of the front document
            
            set level_a to (100 - (_cue getLevel ofChannel channel_a))
            
            set cmd_string to (channel_a as string) & "@" & level_a as string
            
            tell the front document to doCommand string cmd_string
            
            
            
            if _cue = end_cue then
               set finished to true
            end if
            
         end repeat
         
      end if
      
      
   end tell
   
end if

Tarabini
Posts: 6
Joined: Wed Aug 18, 2021 12:21 pm

Re: Invert channel

Postby Tarabini » Thu Aug 03, 2023 6:45 am

That sounds pretty much like what I need.
I'll give it a shot when I'm back at the console.
Thanks!!!

admin
Site Admin
Posts: 230
Joined: Mon Nov 20, 2017 4:31 pm

Re: Invert channel

Postby admin » Thu Aug 03, 2023 3:38 pm

There is a new latest build of LXConsole that includes an "Adjust Channel Level" script. The script will either add or subtract from non-zero levels of a channel in a range of cues. Or, it will invert the level of the channel (100-previous) in the range of cues.

This script is probably a good base for anyone wanting to manipulate the level of a channel in a range of cues in some other way. Any built-in script can be modified by using LXConsole->Install Extras->Copy of Built-in AppleScripts which will put the scripts in the Downloads folder. Put your modified script into ~/Library/Application Support/com.claudeheintzdesign.lxseries/scripts/lxconsole folder for it to appear in the Scrips menu for easy access.

admin
Site Admin
Posts: 230
Joined: Mon Nov 20, 2017 4:31 pm

Re: Invert channel

Postby admin » Thu Aug 03, 2023 3:39 pm

There is a new latest build of LXConsole that includes an "Adjust Channel Level" script. The script will either add or subtract from non-zero levels of a channel in a range of cues. Or, it will invert the level of the channel (100-previous) in the range of cues.

This script is probably a good base for anyone wanting to manipulate the level of a channel in a range of cues in some other way. Any built-in script can be modified by using LXConsole->Install Extras->Copy of Built-in AppleScripts which will put the scripts in the Downloads folder. Edit the script using ScriptEditor and then put your modified script into ~/Library/Application Support/com.claudeheintzdesign.lxseries/scripts/lxconsole folder for it to appear in the Scripts menu for easy access.