Sign in to follow this  
Followers 0
Jos

Kodawrapper - prototype

21 posts in this topic

#1 ·  Posted (edited)

I have been playing for a while now to create a wrapper for Koda which would do the following for me:

When editing a script in SciTE it will:

- Scan the script for previous saved GUI's

- Prompt for the GUI to be edited or new start a new one.

- Start Koda with the form to be updated/added.

- Press shortcut, to save te form and process the (updated) GUI syntax and put it back into the currently edited script UPDATING the selected GUI.

To get this prototype working for the people using the current SciTE4AutoIt3 install do the following:

- Download attached KodaWrapper.zip and save it in C:\Program Files\AutoIt3\SciTe\FormDesigner.

- UNzip

- Add these lines to SciTEUser.properties:

# 12 FormWrapper for lookfar's Koda FormDesigner

command.12.$(file.patterns.au3)="$(SciteDefaultHome)\Koda\KodaWrapper.exe" "$(FilePath)"

command.save.before.12.$(file.patterns.au3)=1

Now start Koda as you normally would.

KodaWrapper will only find GUI's saved by KodaWrapper, meaning initially it does not detect other GUIs (Is on my wish-list but first want the basics working correctly before starting that step.)

When you are ready with designing your form, press the shortcut as shown in the Koda TitleBar (Alt+x)

This will:

- generate te code and put it n the clipboard.

- Save the form to the Program directory with the specified name.

- close koda.

- update the Current script.

This is still work-in-progress and should only be performed by those that understand the process. When this is something people want and it ready, I will include it as a standard function in the SciTE4AutoIt3 installer....

Thoughts ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I am kinda surprised that nobody at all responded to the post.

So nobody is interested to be able to EDIT Koda generated GUI syntax on the fly, but rather do it manually ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Sorry Jos, I don't use Koda because I find it too complex for making GUI's. If I did, I'm sure any idea you come up with will be a good one :-)

Share this post


Link to post
Share on other sites

Sorry Jos, I don't use Koda because I find it too complex for making GUI's. If I did, I'm sure any idea you come up with will be a good one :-)

Interesting - and sudden opinion... :) Can you explain please what the complexity of Koda you found? Of course, Koda written in Delphi so it's interface and name convention may be a bit unusual for some, but seems you first who tell about "complexity"...

Share this post


Link to post
Share on other sites

I didn't try Kodawrapper yet, but it sounds like an interesting and good idea :mellow: ! It would be even more useful, if Koda could generate code for some more properties of GUI elements... I was really surprised, as I designed my first GUI with Koda and only "GUICtrlCreate..." statements were generated, but no "GUICtrlSet..." statements (although you can set these properties in Koda). Thus, you have to edit the AU3 script code manually anyway in case of a GUI overhaul. (Of course it's not impossible, that my faulty operation caused the failure... :) )

Share this post


Link to post
Share on other sites

I use UltraEdit instead of SciTe, but I will give it a go. Sounds like a really good idea.


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

Interesting - and sudden opinion... :) Can you explain please what the complexity of Koda you found? Of course, Koda written in Delphi so it's interface and name convention may be a bit unusual for some, but seems you first who tell about "complexity"...

Don't want to hijack the thread so I'll PM you with the reasons I don't use it.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Interesting - and sudden opinion... :) Can you explain please what the complexity of Koda you found? Of course, Koda written in Delphi so it's interface and name convention may be a bit unusual for some, but seems you first who tell about "complexity"...

My issue is also of complexity, not of the use of Koda, but of integrating the output of Koda into a script, actually that is not too bad, what is really bad is when I realize that I have to make changes in the window content and then integrating that ouput into a script.

I like Koda, but the output requires a lot of hand editing, (all the variables have to be renamed, many variables have to be created, there are styles and extended styles that are not in GUIconstants). I haven't looked at JdeB's wrapper yet, if it is up to class of work he usually puts out it will probably be great.

My wish list for Koda includes:

1- The option of having meaningful variable names based on the user names of controls

2- The option of having a variable for each control

3- The option for Koda to generate Select...Case...Endselect section that includes each control, NOT JUST the escape Case

4- Including GUIconstants in the generated code for all the styles and extended styles that are not in the AutoIt GUIconstants.

5- The ability of Koda to import a Koda generated screen script.

I'd be happy to discuss any of these wishes at length if you're interested.

Gene :mellow:

H'mmmn, it was not my intention to hijack the thread either. @JdeB would you move this to the Koda thread or have it moved if you're not a moderator. Gene

Edited by Gene

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

My wish list for Koda includes:

1- The option of having meaningful variable names based on the user names of controls

Are you using the latest version? Whenever I place a control, the variable name automatically becomes the control name.

2- The option of having a variable for each control

Same as above, all controls automatically have variables, except labels, but there is a 'has variable' option for label controls.

3- The option for Koda to generate Select...Case...Endselect section that includes each control, NOT JUST the escape Case

I disagree on this for Koda, because once I write the code to perform the actions necessary for each event, I am not going to use Kodas blank template again, I just paste in code for the GUI. Any extra events for new controls I write in manually.

4- Including GUIconstants in the generated code for all the styles and extended styles that are not in the AutoIt GUIconstants.

Should this be update the AutoIt GUIconstants so that it contains a complete list?

5- The ability of Koda to import a Koda generated screen script.

Don't that will happen as trying pick the user's code from the Koda code would be hard. I think that a method of updating the GUI creation part only in an au3 based on Koda changes would be good. Which is what I think Kodawrapper does (still have not tried it though).

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Are you using the latest version? Whenever I place a control, the variable name automatically becomes the control name.

Same as above, all controls automatically have variables, except labels, but there is a 'has variable' option for label controls.

I disagree on this for Koda, because once I write the code to perform the actions necessary for each event, I am not going to use Kodas blank template again, I just paste in code for the GUI. Any extra events for new controls I write in manually.

Should this be update the AutoIt GUIconstants so that it contains a complete list?Don't that will happen as trying pick the user's code from the Koda code would be hard. I think that a method of updating the GUI creation part only in an au3 based on Koda changes would be good. Which is what I think Kodawrapper does (still have not tried it though).

QUOTE(Gene @ Mar 18 2006, 09:36 PM) Posted Image

Responding to @Stumpii's comments...

My wish list for Koda includes:

1- The option of having meaningful variable names based on the user names of controls

Are you using the latest version? Whenever I place a control, the variable name automatically becomes the control name.

2- The option of having a variable for each control

Same as above, all controls automatically have variables, except labels, but there is a 'has variable' option for label controls.

Obviously I missed that upgrade : " /> but now I have it and have tried it out.

3- The option for Koda to generate Select...Case...Endselect section that includes each control, NOT JUST the escape Case

I disagree on this for Koda, because once I write the code to perform the actions necessary for each event, I am not going to use Kodas blank template again, I just paste in code for the GUI. Any extra events for new controls I write in manually.

Your stated disagreement was why I wanted it to be an option*, besides you could just copy and paste the new part of interest to you. That is already what I've been doing when I have to edit a Koda window.

(*) It could be an option on the options window, but might be better at the point of generation.

4- Including GUIconstants in the generated code for all the styles and extended styles that are not in the AutoIt GUIconstants.

Should this be update the AutoIt GUIconstants so that it contains a complete list?

Yes, it should, I have asked for that months ago. Since for whatever reason it hasn't happened, I think it should appear at the top of the generated code so it is obvious to everyone that it should be added to the GUIconstants.

5- The ability of Koda to import a Koda generated screen script.

Don't that will happen as trying pick the user's code from the Koda code would be hard. I think that a method of updating the GUI creation part only in an au3 based on Koda changes would be good. Which is what I think Kodawrapper does (still have not tried it though).

The best way to have something not happen, is to not ask for it. In a month my top 5 wishes for Koda will be very different. What I thought were 3rd and 4th are now 1st and 2nd. Gene :) Edited by Gene

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

Have finally tried the Kodawrapper and it works good. Some limitations due to Koda, but other than that, very useful.

I think that you need to add some extra info to the first post though. I could not get the wrapper to work without investigating how the code worked.

For other beginners, this is how I got the Koda wrapper to work:

1. Take blank au3 file. Edit in your fav editor. Save as MyTest.au3 or whatever.

2. Start Koda, create a GUI, save as MyTest.kfx in the same folder as the au3 file.

3. Generate the Koda form code and paste into MyTest.au3. Close Koda.

4. For SciTe users, make editor changes as per JdeB's comments.

5. For UltraEdit users, create a new tool configuration pointing to the Kodawrapper with "%f" as the command line argument. Make sure that any DOS output and clipboard copying is disabled (Kodawrapper edits the file directly).

6. Make the following changes to the MyTest.au3 file.

6a. Add the following before the GUICreate line: ; ### GUI generated with Koda ### Form:MyTest

6b. Add the following after GUISetState: ; ### End GUI generated with Koda ### Form:MyTest

7. Save MyTest.au3.

8. Run Kodawrapper from SciTe/UltraEdit. A popup will appear with MyTest selected. Click OK.

9. Koda will open with the MyTest.kxf form loaded.

10. Make changes.

11. Press ALT+X to close. The form code will be generated and the form saved.

12. MyTest.au3 will be edited in the background and ScitTe/UltraEdit should reload the updated file.

To JdeB: I have asked lookfar (Koda writer) to add an option to automatically generate the GUI code and also add more descriptive text to the dialog boxes to make the Kodawrapper a bit more robust.

One thing that I would like to change is the fact that the ; ### End GUI generated with Koda ### Form:MyTest line is after, not before the GUISet State line. I would like it move, or an option to have it moved. The reason being that if there are any GUI bits that cannot be done in Koda, it would give the user the option of having them in the au3 file before the GUI is shown. The wrapper would therefor not mess with them.

Here is an example of what I am talking about:

#include <GUIConstants.au3>
; ### GUI generated with Koda ### Form:Test
$Test = GUICreate("test", 412, 297, 195, 122)
$MyLabel = GUICtrlCreateLabel("ALabel1", 64, 96, 43, 17)
GUICtrlCreateLabel("ALabel2", 64, 144, 43, 17)
$Edit1 = GUICtrlCreateEdit("", 144, 64, 193, 145)
GUICtrlSetData($Edit1, "AEdit1")
$Button1 = GUICtrlCreateButton("AButton1", 152, 8, 113, 17, 0)
$Button2 = GUICtrlCreateButton("AButton2", 152, 32, 113, 17, 0)
; ### End GUI generated with Koda ### Form:Test

; I can do any non Koda stuff here before the form is shown
; Set label to todays date/time
GUICtrlSetData ( $MyLabel, _Now())

GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

Another thing that would be nice is to keep a message box like "Click OK once you have finished editing in Koda." up because there was a bunch of times I forgot about Alt-X and just exited Koda. Clicking OK would start closing Koda down (same as ALT+X).

Good work!


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

Your stated disagreement was why I wanted it to be an option*, besides you could just copy and paste the new part of interest to you. That is already what I've been doing when I have to edit a Koda window.

Yes, I didn't understand your comment correctly :"> . It would be a good idea the first time you create the GUI, especially for beginers that don't understand the msg loop.

Yes, it should, I have asked for that months ago. Since for whatever reason it hasn't happened, I think it should appear at the top of the generated code so it is obvious to everyone that it should be added to the GUIconstants.

I guess that it does take time for stuff to filter into the system. One for the Koda team i guess.

The best way to have something not happen, is to not ask for it. In a month my top 5 wishes for Koda will be very different. What I thought were 3rd and 4th are now 1st and 2nd. Gene :)

True. The Kodawrapper is a good workaround for the mean time though. I don't know if you have tried Kodawrapper with the latest Koda. If you have not, take a look at my last post that details the steps I use to set it up. Once configured, the only part of the au3 that is edited using Kodawrapper is the part between the ; ### GUI... and ; ### End GUI... lines, which leaves the message loop intact. This is exactly what I personally hoped it would do. I can edit the msg loop myself if I add/delete controls.

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

Awesome script.

Just installed it by mixing JdeB's and Stumpii's installation instructions, works great for me, something I was really looking for. Thanks JdeB for the script and Stumpii for the comments.

At least in my SciTE directoy there was no SciTEUser.properties file by default, create it by opening SciTE => Options => Open User Options File.

Best Regards


This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

My main wish for Koda and the reason why I only use it sometimes right now is to be able to use "Callbacks" (i.e. GuiCtrlSetOnEvent) instead of a message loop for the Event handling.

I'd like to be able to set the name of the Event function in Koda itself and then when I generate the code I'd like Koda to put calls to GuiCtrlSetOnEvent on the auto generated code.

If Koda did that it'd be fantastic!

Angel

Share this post


Link to post
Share on other sites

I'm not sure if I'm not using this correctly, or if I'm not completely understanding what it is intended for.

Here's is the GUI section I get when doing a test to see how this works:

; == GUI generated with Koda ==
; ### GUI generated with Koda ### Form:MyTest
$MyTest = GUICreate("MyTest", 412, 297, 302, 218)
$Group1 = GUICtrlCreateGroup("AGroup1", 40, 32, 113, 161)
$Button1 = GUICtrlCreateButton("AButton1", 56, 56, 49, 25, 0)
$Radio1 = GUICtrlCreateRadio("ARadio1", 56, 88, 49, 25)
GUICtrlCreateLabel("ALabel1", 56, 168, 43, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
; ### End GUI generated with Koda ### Form:MyTestoÝ÷ ØÚ0!§]i÷°)Þ²Ú,yèi»­¶â±È^rGjwlj÷É7¬µ«·jwaj÷­+ºÚ"µÍÌÍÐÚXÚÙYHBÈOHÕRHÙ[]YÚ]ÛÙHOBÈÈÈÈÕRHÙ[]YÚ]ÛÙHÈÈÈÜN^UÝÌÍÓ^UÝHÕRPÜX]J    ][ÝÓ^UÝ  ][ÝË
LMËÌN
BÌÍÑÜÝHHÕRPÝÜX]QÜÝ
    ][ÝÐQÜÝI][ÝË
ÌLLËMJBÌÍÐ]ÛHHÕRPÝÜX]P]Û  ][ÝÐP]ÛI][ÝË
M
M
KK
BY  ÌÍÐÚXÚÙYHH[QÕRPÝÙ]Ý]H
LK  ÌÍÑÕRWÐÒPÒÑQ
B[YÌÍÔY[ÌHHÕRPÝÜX]TY[Ê  ][ÝÐTY[ÌI][ÝË
M
KJBÕRPÝÜX]SX[
    ][ÝÐSX[I][ÝË
MM
ËMÊBÕRPÝÜX]QÜÝ
    ][ÝÉ][ÝËNNKNNKKJBÕRTÙ]Ý]JÕ×ÔÒÕÊBÈÈÈÈ[ÕRHÙ[]]ÛÙHÈÈÈÜN^

Then I decide maybe I want to move my group box somewhere else, so I run KodaWrapper and make my change. Then I hit Alt-X to save the changes. Now when I go back to the MyTest.au3 file, it appears as it did in the first code above and my IF check is gone.

Is KodaWrapper only intended to work on the code that affects the look and layout, ignoring (and omitting) any other coding added? If that is the case, this severely limits what you can do after your initial Koda codes have been created.

After I've got the GUI the way I originally want it to look, I'll then add code for checking buttons/checkboxes as required, filling in default input text, etc. Then, maybe I don't like the layout, so I want to move things around. Am I not able to do this with KodaWrapper and am resigned to doing it manually instead, because it will delete all of my "extras"?

Share this post


Link to post
Share on other sites

This is something i will use alot more often because when i use koda, i am constantly forgetting to add my buttons, and i don't usually save my forums, so i would just end up re-doing the whole code again!

Share this post


Link to post
Share on other sites

is this still active? I am very much interested in this. I mostly hang out in the scrips n scraps section, so only just noticed this post. Any testing needed? I am happy to do it. I think it would be great to be able to make a gui much like in VB and then come back and modify it ... even after making coding changes. My hope is that this would allow that.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

is this still active? I am very much interested in this. I mostly hang out in the scrips n scraps section, so only just noticed this post. Any testing needed? I am happy to do it. I think it would be great to be able to make a gui much like in VB and then come back and modify it ... even after making coding changes. My hope is that this would allow that.

Its there to use it, but i have not developed it any further because i am not sure what direction Koda will develop at this moment. I' haven't included it in the official SciTE4AutoIt3 yet because I don't think its ready for that yet.

I really would love to see some better support for this approach in Koda.....

:D

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I don't like the idea of the wrapper though I may give it a go. I think we all agree that even if we want some custom macro we need more from Koda to really be fully usable. I think though that coda is really on the right track.

I just found the advanced generate templates and see there a great place to "give the power to the people" The standard loop example template is:

#include <GUIConstants.au3>

%INCLUDES%

%OPTIONS%

%EXPVARINITCODE%

%GUICODE%

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

%LOOPCODEBEGIN%

Case %CONTROL_ID%

%LOOPCODEEND%

EndSwitch

WEnd

I do not understand what the %EXPVARINITCODE% does but I have to assume that %GUICODE% is simple a place holder for the code that comes from the Koda xml.form file. I just realized what I plan to do.

Simple post processing by search and replace would do the trick.

in text fields use *$myvar*, this includes combo lists and default text.

After pushing the code to myform.au3, and I have found it best to keep it separate anyway preproduction, do a search and replace.

all => "* <= get removed as well as all => *" <=

close to the top of my form I keep a list of variables I am using as I work with the koda form. These two files stay together

myform.au3 and myform.kxf When I'm ready to fully use the form I copy and paste it in my main project. This way I can polish and work the bugs out to my hearts content and come back to the project much later and be able to pick it where I left off.

Can you tell me a bit about the advanced generate templates as it might simply things further?

Great Work, I feel this has extreme potential!

Barry


****************************noob[quote]"I never did give them hell. I just told the truth, and they thought it was hell."- Harry S Truman[/quote]

Share this post


Link to post
Share on other sites

That works fairly well though now I would prefer that Koda clobber its field in my script and then I rerun my string replacements. I need to figure out how to get SciTE to do more complex replacements because I want to do arrays also, txtField1 => txtField[1] or even multi-line replacements.

Where can I get some good help on this sort of thing for SciTE?

Thanks,

Barry


****************************noob[quote]"I never did give them hell. I just told the truth, and they thought it was hell."- Harry S Truman[/quote]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0