メインコンテンツへスキップ

⚠️ Please note that this topic or post has been archived. The information contained here may no longer be accurate or up-to-date. ⚠️

Script to open Live View and adjust Lightness

コメント

21件のコメント

  • Marcus Mader

    To be more specific, I am typically running Capture One 12, tethering with a Phase One IQ3 back and shooting in a studio setting. Every time we open Live View, the image is way too dark to be useful. We have to increase Lightness to it's maximum value  which is 3. We always need it turned up so I thought it would be great to automate...

    0
  • Marcus Mader

    Never made my own script before but would something like this work? 

     

    tell "Capture One 20" 

    if "begin live view" then

    set "lightness" to {3}

    end tell

    0
  • Eric Valk

    I don't have a camera that I can do live view with, but i've written a lot of Applescript.

    To start with, down load a trial version of Script Debugger, it's much better the Script Editor. You can keep the trial version running forever, at reduced capability, if your don't want to purchase. (IMO, it's worth every penny)

    Syntaxes for the tell statement are:

    tell referenceToObject to statement

    and

    tell referenceToObject
    [ statement ]...
    end tell

    So we start with

    tell application "Capture One 20" to statement 

     "tell" sets the reference object for the enclosed statements. Commands apply to this object and objects and properties belong to this object.

    We want to start live view. The application responds to this command; the syntax is:

    begin live view

    Putting it all together


    tell application "Capture One 20" to begin live view

    As far as I can tell lightness is a property of the readout, it can be read, but not changed.

    I see two choices.

    1) You can change the the EV adjustment property of the Camera (which is a child object of the Document) like this:

    set theEvText to "cameras_ev_text_string"
    tell application "Capture One 20" to tell the current document¬
    to tell its camera to set its EV adjustment to theEvText

    Note that  ¬  is the line continuation symbol, it is used to make long commands wrap to improve readability. It can be omitted, and the two lines joined together as one. Without it, the previous code looks like this, which is difficult to read in Script Editor and Script Debugger

    tell application "Capture One 20" to tell the current document to tell its camera to set its EV adjustment to "cameras_ev_text_string"

    You may have to run this once to find the right string  for cameras_ev_text_string:

    tell application "Capture One 20" to tell the current document¬
    to tell its camera to set evAdjustmentList to its available EV adjustments
    log evAdjustmentList

    2) Alternatively, after capturing the image from the camera you can write some Applescript to change the exposure or brightness of the variants's adjustments:

    set theBrightSetting to 3 as real
    tell application "Capture One 20" to tell theVariant¬
    to tell its adjustments to set its brightness to theBrightSetting

    I haven't said how to set the variable theVariant, but that depends a lot on how you import the captured image into Capture One.

     

    0
  • Marcus Mader

    Thanks very much for your response. To be clear, our issue has nothing to do with the still images coming in from the tethered camera, ONLY the video feed that we see during Live View. I would only need the "Lightness" of the video feed to be adjusted and only while we are in live view. As soon as we close live view, the camera's photography settings would need to be the same as before we opened live view. 

    I'm not sure that the EV solution would work for us. I don't really understand how that value system works (what I would set the parameter to once Live View is open).

    When I adjust the "Lightness" slider in Live View, it seems to be adjusting the camera's ISO and shutter speed to increase the brightness of the video feed. This seems similar to adjusting EV. The "Lightness" slider has a numerical value that goes up to 3, which is where I need it to be all of the time. 

    Maybe what I need is just not possible because "Lightness" is r/o in C1?

    0
  • Eric Valk

    Marcus, your assement is correct, neither option I proposed would let you control the Lightness.

    It is not possible for AppleScript to control Live View's lightness setting in the normal way, I reccomend that you make a feature request for this.

     

    There is a complicated way (i.e. not for beginners) for Applescript to control Live View's Lightness slider; I have made an attempt at it.

    Can you run the following script from Script Editor and tell me if Capture One 12's Live View Lightness slider is changed from 0 to 3?  (Live View should be active first.)

    If the setting is not 3, then open Script Editor's Log window, select Replies, copy and paste the results in a reply here, formatting the results as Code

    set theAppName to "Capture One 12"
    set debug to false
    set LightValue to 3

    tell application "System Events"
    tell application process theAppName
    set frontmost to true
    tell window "Live View"
    tell group 1
    tell group "LivePreviewAdjustments"
    if 0 = (get count of groups) then tell checkbox 1 to click
    tell group "Lightness"
    tell first slider
    set LightStartValue to get its value
    set value to LightValue
    set LightEndValue to get its value

    if debug or (LightValue ≠ LightEndValue) then
    set debug to true
    get properties
    get attributes
    get actions
    get UI elements
    end if
    end tell
    if debug then
    set debug to true
    get properties
    get attributes
    get actions
    get UI elements
    end if
    end tell
    if debug then
    set debug to true
    get properties
    get attributes
    get actions
    get UI elements
    end if
    end tell
    if debug then
    set debug to true
    get properties
    get attributes
    get actions
    get UI elements
    end if
    end tell
    if debug then
    set debug to true
    get properties
    get attributes
    get actions
    get UI elements
    end if
    end tell
    if debug then
    set debug to true
    get properties
    get attributes
    get actions
    get UI elements
    end if
    end tell
    end tell

    log {"LightStartValue", LightStartValue}
    log {"LightEndValue", LightEndValue}

     

    0
  • Marcus Mader

    I ran the script while Live View was open and it worked! 

    I tried saving that code as a .scpt file and tossing it in the capture one scripts folder. I updated the scripts menu but it did not run automatically after that. I also tried it inside the background scripts folder and that didn't work either.

    Does the code need to be altered from here to work automatically? 

    Thank you so much for your help. 

    0
  • Eric Valk

    Hi Marcus

    I'm very pleased that it works too. The previous script includes a lot of stuff to provide debugging information in case it didn't work. I will now remove that, and combine it with the previous one line that we had.

    Once we verify that Script Editor runs it successfully as .scpt file, then we will convert it to a  .app file, and we have to give it suitable security permissions to allow it to do what it does, which is manipulate the user interface and manipulate Capture One.

    Then we can let Capture One run the .app file.

    What version of OSX are your running, do you have any plans to upgrade OSX?   (Managing the security and permissions becomes increasingly difficult as you upgrade the OS).

    0
  • Eric Valk

    Hi Marcus

    And here is the script with everything combine. Now we need to check that it executes successfully and correctly when Script Editor runs it. Capture One should be started but Live View window not open yet.

    use AppleScript version "2.4"
    use scripting additions

    set LightnessValue to 3

    tell application "Capture One 12"
    begin live view
    set theAppName to its name
    end tell
    delay 0.3

    tell application "System Events" to tell application process theAppName
    set frontmost to true
    tell window "Live View" to tell group 1 to tell group "LivePreviewAdjustments"
    if 0 = (get count of groups) then tell checkbox 1 to click
    tell group "Lightness" to tell first slider to set value to LightnessValue
    end tell
    end tell
    0
  • Marcus Mader

    Hey Eric. I just tried that last bit of script in Script Editor and it worked. It successfully opened Live View and adjusted the Lightness. 

    I am trying to set this up on the photographer's laptop. It is a MacBook Pro running Catalina 10.15.3. She doesn't prefer keeping her OS up to date as I typically would. 

    Hopefully you can give me a hand converting that code into a .app file. 

    Thanks again!

    0
  • Eric Valk

    Converting to an app is dead simple. Debugging Security issues is a more tricky.

    Open the script in Script Editor, and use Save As to save it as an application.

    Now before you try it witth Capture One,

    First run it from Script Editor to find and remove any remaining Applescript issues. Might have to handle some security permission here, not sure.

    Then run it as an application (starting it from Finder), and give it the security permssions needed for a  standalone application.

    There will be a number of security related pop ups, Its IMPORTANT to answer each one with a Yes. Likely have to give it permsission to use Accessibility Features and Disk Access permission.

    I'll be a little out of my depth here, as I am intentionally not running Catalina yet. But I'll help as best I can.

    Once you have it running as standalone application, in the Capture One script folder, ONLY then try running it from Capture One. You may have to update security permissions for Capture One.

    (You seee why I am still running 10.14.6)

     

    0
  • Marcus Mader

    I changed as many allowances as I could. When I try running the .app from within C1, it gives me an error message:

     

    AppleScript Error

    Error -1728 occurred:

    Can't get window "Live View" of application process "Capture One 12".

    0
  • Eric Valk

    Does it give the same error when you run it from "Finder"?

    0
  • Marcus Mader

    Nope. There is no error message when I open the .app from Finder. It just opens Live View and makes the Lightness adjustment. 

    0
  • Eric Valk

    OK, what I see is that MAcOS is restricting access to  Accessbility features. Since the application runs OK standalone, it must be Capture One that needs additonal permission.

    Try granting Capture One permission to use Accessibility features

    0
  • Marcus Mader

    I gave C1 access to Accessibility features, then restarted C1 and ran it inside the program again. Still no luck. It's giving me the same 1728 error message. 

    0
  • Marcus Mader

    Running it inside C1 does open Live View. Then it gives me the error message. It does not adjust the Lightness.

    0
  • Marcus Mader

    I put the .app into the "Capture One Scripts" folder. Does it need to be nested inside of "Background Scripts"?

    0
  • Eric Valk

    "Capture One Scripts" folder is the correct folder for thr application. Is that the only copy of the application (I hope so.)

    The Lightness is adjusted by accessing the controls of the window which is part of Capture One. The first step is to locate the correct window.  If the window cannot be accessed, its controls cannot be changed.

    Its possible that some of the settings are "stuck" due to old data in the system caches.

    What I would try now is a safe boot of the Mac. (this has has worked for me once or twice)

    Shut it down completely, wait 10s and start. Right after the you push start hold down the shift key, until booting is completed. The boot will take much longer than normal.

    When its finished, "Safe Boot" will show at top right corner if the screen in small red letters. Log into the account, open finder, click on a few random folders. The graphics may be a little slow and jerky.

    Go into security preferences, make sure that C1 is enabled in the accessibility pane, also Full Disk Access, and Automation. If not enable it. No need to run C1.

    Now reboot. This will have reset a whole lot of system caches.

    After this I'm out of ideas.

     

    0
  • Eric Valk

    Explanation

    Look at the script:

    begin live view  is  inside the Tell Block for "Capture One" - Capture One's Applescript Interface. This is working.

    tell window "Live View" is  inside the Tell Block for "System Events", this is the interface for Accesibility Features. This appears to be blocked.

    If safe boot does not help, one  diagnostic that you might try to check that we are accessing a correct window is this (the formatting is not great but wth)

    Just before the line that begins with  tell window "Live View"  add this code:

    set winCount to get count of windows
    set winNames to get name of windows
    tell me to Display Notification "There are "& winCount & " windows: " & (get winNames as text)
    0
  • RONNIE B

    Thank you so much for sharing, I hope you continue to write spirit next topic!Unlockmytv

    0
  • Ronald Hughes

    This works really well for us, thank you!

     

    MyBalanceNow

    0

投稿コメントは受け付けていません。