File/script editor - General Discussion and Assistance - CHDK Forum  

File/script editor

  • 15 Replies
  • 7027 Views
*

Offline wontolla

  • ****
  • 413
  • S3 & G9 & A720
File/script editor
« on: 14 / March / 2008, 08:10:58 »
Advertisements
Hi everybody.

There has been a discussion lately in this poll POLL: Which missing features would you like to see?
and people have some interesting ideas in how CHDK can have a "file editor" feature.

It looks like the main purpose of a file editor is to make small changes in script files so you can tweak/correct them without a computer.

Some uses could be:
When you are on the field and find out that, given the situation, one of your scripts could be more useful if you make some changes.
Or may be if you are tired of connecting/disconnecting the SD card to your computer and turning on/off the camera several times while writing/testing a script.

Implementation ideas:
The Script Editor would need some kind of keyboard in the screen so the user can select the letter, number or symbol needed and place it in the desired portion of text. As you can see, this process can "take a while" so it's been suggested to have a second menu where the user can choose from a list of frequently-used uBASIC commands. May be this list can be stored as a file in the memory card and CHDK can come with a "standard" collection of these macros but the user can also modify it according to particular needs.

Well, let's not make the story long. The thing is I've been messing with the current File Reader and I thing with a little work it can be modified to allow writing capabilities. For the moment I'm drawing the keyboard in the lower part of the screen (sorry, no viewable results yet).

But the real fun will begin when modifying the actual script file so I would really appreciate if you have experience/suggestions. I will search the net for some code on this. (No sense reinventing the wheel). I'm also far from being a keen script writer so I will need you scripting guys to help me so this feature can be something useful.

Cheers!








*

Offline mkmenuts

  • **
  • 61
  • SD700 (1.01b)
Re: File/script editor
« Reply #1 on: 14 / March / 2008, 08:56:52 »
You might find this interesting:

http://www.forteach.net/video/video/NvVwphbyvOw

*

Offline wontolla

  • ****
  • 413
  • S3 & G9 & A720
Re: File/script editor
« Reply #2 on: 14 / March / 2008, 10:45:17 »
Thanks mkmenuts, that's a good idea. You just save me a weekend worth of work.

I was working on a typical QWERTY keyboard but that ipod thing looks more efficient.

I thing that's the way to go. The file editor can even have those guide colours!

Re: File/script editor
« Reply #3 on: 14 / March / 2008, 18:41:22 »
Deleted
« Last Edit: 22 / April / 2008, 14:21:31 by Barney Fife »
[acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye


Re: File/script editor
« Reply #4 on: 14 / March / 2008, 23:04:06 »
How about predictive text... like in cell phones?

a quick search in google showed some pieces of code in java,  and some in C

here you have a program licensed under GPL that implement predictive text, so you have a good starting point (and the source code)
http://linux.wareseeker.com/Desktop-Environment/dasher-4.5.2.zip/315306

the dictionary won't be so huge (basic + common words used by geeks who write scripts   :blink:

dictionary of words:
just take a lots of scripts from CHDK, mix them in one file, do some cleaning, sort the words, and "uniq" them, finally filter everything that's useless (this last part is made by hand  :( )

an example for a quick filtering with the help of unix/linux command:

$ sed -e 's/\s/\n/g; s/[\.,"?@]//g' file_mixed.bas | sort| uniq > result.txt

the first search pattern will look for spaces and tabs and replace them for a new line, the second one wipes any occurrence of the following characters .,"?@
(this list can be enhanced)

this procedure will end with a list of words like this one:

Code: [Select]
another
camera
click
current
else
end
endif
get_prop
goto
if
is_key
it
k
k=1
lend
loop
m
m<>15
mode
operation
pictures
print
recording
rem
remote
shoot
shoot_full
start
stop
taking
the
then
to
v
v=1
wait_click

now some hand cleaning and we are ready to go...

just an idea...

Goog luck!

Ixus700-SD500 owner.

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: File/script editor
« Reply #5 on: 15 / March / 2008, 05:17:22 »
(On my dial-up, I can't see that video you referenced, but I'll assume it's the next best thing since sliced-bread. :) )

Just google for MobileQWERTY. (But almost all info is in videos)
CHDK Developer.

*

Offline wontolla

  • ****
  • 413
  • S3 & G9 & A720
Re: File/script editor
« Reply #6 on: 15 / March / 2008, 13:25:20 »
I would just be happy when, in the text editor, if you put the cursor on a letter or number and press [SET] that it would just let you scroll through all ASCII code...
That should be the simplest solution. But if we follow that road, eventually someone will ask for the MobileQWERTY. Double work.

Quote
It's not too different than the keypad on my old Casio Data-Bank wristwatch. 16 keys...
Yep, I also had a Casio Data-Bank. As you say, it has 16 keys. And even a cellphone has at least 12. Both of them have 3 letters on each key.
But in the camera we only have 4-5. The MobileQWERTY is some sort of simulation of a 12 key keyboard.

Quote
But what are you going to do about upper-case?
This MobileQWERTY thing has 4 different "keyboards": uppercase, lowercase, numbers and symbols. I'll stick to this model for now and in the end we can tweak it to fit scripting needs.

Quote
As you press one of the colored keys it would automatically enter common BASIC programming commands like "GOTO", "IF" etc...Couldn't the available ones for a list (or table) be pulled right out of the code for each build.
Sure, I am planning a BASIC command list, but it could take screen real-state. A Predictive Text solution would solve this problem.

How about predictive text... like in cell phones?
Thanks marcelo for the suggestion, link and detailed explanation. I think the Predictive Text solution would be a good way to save a lot of clicks. First, I'll concentrate in the MobileQWERTY. Then, if we see the Predictive Text feasible I'll try to implement it. I'll dare to ask for your help on that dictionary! It looks like you are half-way on getting it.

*

Offline wontolla

  • ****
  • 413
  • S3 & G9 & A720
Re: File/script editor
« Reply #7 on: 21 / May / 2008, 11:14:58 »
Just an update in the file editor coz people's been asking for news.

Interface is almost done. I modified the File Reader making space for the keyboard and joystick colour guide.



Next step is to implement the actual writing of the file. Any comments/suggestions welcome!

Here is for all cameras (build 403) in case you want to play with it. (Remember it doesn't actually modify the file yet).
     Index of /CHDK/FileEditor

You can also download the video to see how the MobileQWERTY works. (.flv file plays with VLC or FLV Player)
     http://www.wontolla.web44.net/CHDK/FileEditor/MQwerty.flv

For developers:
Here is the modified gui_read.c file in case you are curious. Warning: It's nothing than boring drawing pixels.
     http://www.wontolla.web44.net/CHDK/FileEditor/gui_read.c
« Last Edit: 21 / May / 2008, 11:21:32 by wontolla »


*

Offline fe50

  • ******
  • 3117
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: File/script editor
« Reply #8 on: 21 / May / 2008, 12:16:57 »
Look's great...could be an universal keyboard within CHDK...wow !

A feature for the future could also be something like a clipboard in chdk, so lines of an (selectable) diary file and/or chars from this "CHDK keyboard" can be collected & buffered there. Done so, at any other place (in a script, in file manager, in a menu/setting dialog...) with an insert feature the data can transfered there.

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: File/script editor
« Reply #9 on: 21 / May / 2008, 12:33:22 »
nice to see some progress :)

 

Related Topics