Urgent! Please help!!!! - Script Writing - CHDK Forum  

Urgent! Please help!!!!

  • 11 Replies
  • 3896 Views
Urgent! Please help!!!!
« on: 25 / February / 2012, 03:46:58 »
Advertisements
Hello! i have ixus 80 and i am in a middle of a project and i need to manipulate massive amounts of pictures. i  have played a little with CHDK but i never scripted, but i think this script is easy and if someone can help me i will follow this way in my project. if it is a PITA i will go other way because im running out of time!

i want a very simple script:
while in "taking fotos" mode, when  i press for example: Print or Func button "!" appears on the camera screen and the next picture i will take will not be saved as IMG_****.jpg but as FOO_****.jpg or something else, then "!" goes OFF and next pictures continue IMG_****.jpg

i basicaly want to work like this:
~taking thousands of pictures: click click click click FUNC click click click click FUNC click

please, if anyone can assist i will appreciate it!!

Re: Urgent! Please help!!!!
« Reply #1 on: 25 / February / 2012, 08:33:50 »
Ok, it's to be done, but not exactly this way... What's to be exactly done is simmilar to this:

Code: (lua) [Select]
require "drawings"

indicator=draw.add("string", 50, 50, "", "red","black")

--are we in CANON names mode? "" means yes; "!!!" means no
mode=""

--start never ending loop
repeat
    --we draw appropriate thing on the screen
    draw.replace(indicator,"string", 50, 50, mode, "red","black")
    draw.redraw()

    --take a shoot
    shoot()

    --we have to check, whether we are in regular names mode or not
    if(mode=="") then       --seems like we are in CANON names mode
        if(is_pressed("func")) then mode="!!!" end  --if func pressed, then we go to the other mode
    else
    --here will be a magic...
    --here we have to somehow check, what's the name of the taken file
    --there's a function that checks the number of the last photo
    --so it can be converted to the name
    --then we can use Lua command os.rename() or something
    --someone with more knowlendge is needed here...
    --or simply read manuals and do this on your own:)

        if(is_pressed("func")) then mode="" end

    end

    until false

I haven't test that. I WON'T work, as is, you need to add this crucial part - rename of the file. And I'm not really sure, whether behavior of this script is that, what you want - you need to press func key for a little while, after the shoot, to give the is_pressed() function possibility to catch this.

This is only a concept, but the whole idea seems to be easy.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Urgent! Please help!!!!
« Reply #2 on: 26 / February / 2012, 04:23:21 »
hello again! thank for the reply! i still dont know what to do :)
an other idea if it is easyer i can detect EXIF info too
so if it is easyer then a script that changes an option that affects EXIF info could do the job

for example i tested by changing ISO and worked perfect
manualy set iso to 80
click click click (took some pics)
manualy set iso to 100
click (one pic)
manualy set iso back to 80
click click click
etc...
runned my prog, read EXIF info from all pictures, selected those with iso 100
this does the trick for me too!
But i have 2 problems here!
1) i want to keep iso auto adjusted
2) i want to turn "note this picture" on/off with just one button
so if there is even an "unorthodox" way to do this im very open minded!
if you know a script/way that changes an option before i take a picture that reflects to exif info and doesn't affect much picture quality please let me know
it just has to be one button job so i can quickly toggle it on/off !

the hackiest thing i've done with my camera is install chdk...oh and maybe take a picture through goggles :)
but i can turn a wrench in .net, im not a developer though

anyway thank you in advance!


----
Tom

Re: Urgent! Please help!!!!
« Reply #3 on: 26 / February / 2012, 09:54:44 »
I think you are looking for something like this - in combination with the code outslider posted above :

http://chdk.wikia.com/wiki/Lua#TagMe.2C_the_Lua_EXIF_tagger
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Urgent! Please help!!!!
« Reply #4 on: 26 / February / 2012, 12:46:22 »
i love you!! i will take a look tonight!!!

Re: Urgent! Please help!!!!
« Reply #5 on: 26 / February / 2012, 13:49:10 »
i love you!! i will take a look tonight!!!
Don't get too excited - you (or somebody) is going to need to do some coding to pull this together.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Urgent! Please help!!!!
« Reply #6 on: 27 / February / 2012, 05:44:43 »
i can try something! excitement keeps you walking sometimes!
i've read there is no known way to damage my camera while playing with scripts so what is the worst that  will happen?

 rightnow because i have to do progress in my project,  what im doing is press a button on my laptop each time i want to tag a picture and log the time, i have the pc clock and camera clock synced.
then i read "time taken" exif info, because date modified/access/created file info sometimes gets edited while copying the picture from folder to folder, and select the "tagged" pictures only based on that.
it pretty much works but it has me tied to a laptop

Re: Urgent! Please help!!!!
« Reply #7 on: 27 / February / 2012, 06:25:22 »
Hey! This idea with the laptop suggested mi other way to do what do you want. You could do script, which do following thing:

Takes shot after shoot (as you want) and when you press a button it simply adds a line to the log file. With Lua you can make a file and write to it. If this is enough for you it's the most simple thing.

But you have to still remember, that your key pressess on camera can be readed not every time. Probably camera can't be in shooting procedure at the moment. I'm not sure, but it seems that when you use shoot() command camera script doesn't do anything before this command end. Maybe with press("shoot_half") the behavior will be different.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


Re: Urgent! Please help!!!!
« Reply #8 on: 27 / February / 2012, 07:06:43 »
ok this can be super simple nothing to do with shooting!

1) when pressing a specific button "!" appears and camera saves time in a log
2) when pressing the button again "!" disappears and camera saves time in a log again

this way i can work like this

shoot shoot shot ! shoot ! shoot shoot shoot !shoot ! shoot shoot

nasty?
« Last Edit: 27 / February / 2012, 07:11:37 by tomari »

Re: Urgent! Please help!!!!
« Reply #9 on: 27 / February / 2012, 07:59:38 »
Sure. Now read more on Lua commands page and it should be very simple for you to write it:)

If you like to know more about writing to file you could analyze the code of EDI - text editor written in Lua, which should be placed in CHDK/SCRIPTS/EDITOR directory on your SD card ;) I believe that case study will be more helpfull than crude description.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

 

Related Topics