Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Looking for Script Review on a Digicam Associated Script.

73 views
Skip to first unread message

universalde...@gmail.com

unread,
Nov 21, 2017, 8:03:33 AM11/21/17
to
Good Morning,

I am attempting to control the exposure in Digicam Control (which uses TCL) where I will change the exposure, capture a picture, and change the exposure back.

The purpose is that I can only see at a higher exposure, and get a quality picture at a lower exposure. I'm taking lots of pictures in succession and it is cumbersome to be clicking back and forth.

This is where the scripting would be helpful.

Portions of my script work. However, I am attempting to use a key binding to execute this operation, and it is non-functional.

Can someone look at my script and let me know where I went wrong? You will see dcc preceding some lines, and this is necessary for Digicam to run certain operations.

This is where I'm at:

set view_exposure 0.0
set pict_exposure -3

proc picture { } {

dcc Set exposurecompensation $pict_exposure

after 250

dcc capture

after 1000

#set back to original exposure
dcc Set exposurecompensation $view_exposure
}

bind . <Control-Key-a> { picture }

Thanks for your help, and have a great Thanksgiving!

Ralf Fassel

unread,
Nov 21, 2017, 8:40:40 AM11/21/17
to
* universalde...@gmail.com
| Portions of my script work. However, I am attempting to use a key
| binding to execute this operation, and it is non-functional.

Start by describing what "it is non-functional" means:
Do you get error messages? Are the pictures not what you expect?
Does the key binding not trigger? etc pp.

| Can someone look at my script and let me know where I went wrong?

The immediate error is you set variables at global scope and use them
inside the proc as if they were local scope.

Look up the 'global' command in tcl to understand how to access global
variables from inside a script:

https://www.tcl.tk/man/tcl/TclCmd/global.htm
https://www.tcl.tk/man/tcl8.5/tutorial/Tcl13.html

HTH
R'

universalde...@gmail.com

unread,
Nov 28, 2017, 8:41:15 AM11/28/17
to
Ralf,

Thank you for the response.

In terms of non-functional - they key binding does not trigger. Therefore, I agree with you that I am attempting to execute the script in the way you described.

Would you be able to provide some sample code which uses the global command?

Thank you!

Ralf Fassel

unread,
Nov 30, 2017, 11:33:49 AM11/30/17
to
* universalde...@gmail.com
| Would you be able to provide some sample code which uses the global command?

Did you look at:

| > https://www.tcl.tk/man/tcl/TclCmd/global.htm

? There are code snippets in there.

In short:

# set variable outside of any proc (i.e. global namespace)
set some_global_variable 1
# play it safe: explicitely specify global namespace
# set ::some_global_variable 1

proc this_does_not_work {} {
# error: variable is addressed in local scope where it does not exist
puts "the value is $some_global_variable"
}

# using 'global' command
proc this_does_work_1 {} {
global some_global_variable
# ok: variable is declared as global
puts "the value is $some_global_variable"
}

# using explicit namespace
proc this_does_work_2 {} {
# ok: variable is addressed in global namespace
puts "the value is $::some_global_variable"
}

Calling them:

% this_does_not_work
can't read "some_global_variable": no such variable
% this_does_work_1
the value is 1
% this_does_work_2
the value is 1

HTH
R'
0 new messages