Morthawt

Utilising existing GUI code in koda.

13 posts in this topic

#1 ·  Posted (edited)

I have a program I made long ago for something but I never saved the koda file so it would make it a complete pain for me to visually tweak anything because as far as I am aware, I would have to design an entirely new GUI.

Would it be possible for you guys at AutoIt to add functionality to Koda so that you can take an existing GUI section, with while loop and cases and all and then koda would literally build it ready for tweaking and where existing things still exist and have been tweaked, it would tweak such details and keep all the existing case information and added formatting things that were manually tweaked etc?

This would be really amazing and I feel that other people would benefit from it. I can't be the only person who makes a GUI, doesn't save it and then has no problems making minor tweaks in-code but struggles like hell to go rearranging things perfectly. That is where using a GUI (koda) to make and arrange a GUI you are making, makes everything easy and pleasure to deal with.

tldr;

Example:
A friend gives me his code and wants help. The GUI is just a mess, but trying to do all the alignment and positioning all by digits in code would be a pain. I cannot just hallucinate where everything is based on pixel locations and sizes. So I would take the entire GUI chunk of code, all the form/controls/formatting functions/while loop/switch/case in it's entirety and paste it into an area of Koda and press a button. Koda would then build the GUI on the screen, placing all the controls and formatting them with the instructions that may have been added and keeps the case information as-is. Then when you make your alterations in Koda, you go to export it and it makes an entirely new export that re-makes (from scratch as if you had made this GUI from scratch) all the code for controls, size, placement etc and then also adds all the existing case code back as part of the code you then send (or manually copy/paste as I do) to Scite editor.

Is there any chance this could be implemented? I think this could help a lot of people with their own scripts and others'.

Edited by Morthawt
feature request tag

Share this post


Link to post
Share on other sites



2 minutes ago, l3ill said:

Hi Morthawt,

 

Correct me if I misunderstand, Koda has an import function that does this...

You can then save a new kxf file with your new settings.

I forgot all about that. I only ever tried it once back in the ancient past but Koda crashed so I never gave it a thought since. I will give it a try again. Thanks.

Share this post


Link to post
Share on other sites

Crashed again

WAMipvo.png

It does not like importing an AutoIt script. My idea is that Koda would import it, build the GUI and take on all the formatting and everything and then preserve everything else like the cases and all the rest of the script, so that you can export it and it would be your same old script just with your tweaked out fixed GUI.

Share this post


Link to post
Share on other sites
16 minutes ago, JohnOne said:

It's also possible ISN AutoIt Studio has import functionality.

I thought this was that cool looking (but I think abondoned) Koda replacement someone made with AutoIt it's self. But this I think is not it. Plus I do not see anything in here to do with a GUI. So I am a bit confused.

Share this post


Link to post
Share on other sites
1 minute ago, JohnOne said:

It is a complete IDE for AutoIt, and includes a GUI designer, and far from abandoned, where as koda is very much abandoned as far ad I know.

I have looked up and down and I find nothing in there about GUI or forms other than a folder on the right which looks like it is about forms but nothing is in there and the script I am using does have 2 forms in it.

Share this post


Link to post
Share on other sites
28 minutes ago, JohnOne said:

It is a complete IDE for AutoIt, and includes a GUI designer, and far from abandoned, where as koda is very much abandoned as far ad I know.

Here is a sample script I made. Originally the gui was inside a function (as the one I am working on is) but that did not work so I commented out the func and I still see no way of seeing any GUI editing capability anywhere in the entire program:

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>



Sleep(3000)
;~ CreateGUI()

;~ Func CreateGUI()
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 148, 81, 192, 124)
    $Button1 = GUICtrlCreateButton("Button1", 8, 8, 75, 25)
    $Input1 = GUICtrlCreateInput("Input1", 8, 40, 121, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit

        EndSwitch
    WEnd
;~ EndFunc   ;==>CreateGUI

 

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

On 9/13/2016 at 3:42 PM, Morthawt said:

and I still see no way of seeing any GUI editing

<?xml version="1.0" encoding="windows-1251"?>
<object type="TAForm" name="Form1">
	<properties>
		<property name="Left" vt="Int16">254</property>
		<property name="Top" vt="Int16">188</property>
		<property name="Width" vt="Int16">156</property>
		<property name="Height" vt="Int8">108</property>
		<property name="Caption" vt="String">Form1</property>
		<property name="Color" vt="Ident">clBtnFace</property>
		<property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property>
		<property name="Font.Color" vt="Ident">clWindowText</property>
		<property name="Font.Height" vt="Int8">-11</property>
		<property name="Font.Name" vt="String">MS Sans Serif</property>
		<property name="Font.Style" vt="Set"/>
		<property name="OldCreateOrder" vt="True">True</property>
		<property name="Visible" vt="True">True</property>
		<property name="Style" vt="Int32">-1798701056</property>
		<property name="ExStyle" vt="Int16">256</property>
		<property name="Version" vt="String">1.04</property>
		<property name="FormOptOnEvent" vt="False">False</property>
		<property name="FormOptExpVars" vt="False">False</property>
		<property name="FormOptPopulate" vt="False">False</property>
		<property name="FormOptVarsForSet" vt="False">False</property>
		<property name="FormOptIndentChar" vt="Int8">0</property>
		<property name="FormOptIndentCount" vt="Int8">1</property>
		<property name="FormOptIndentInit" vt="Int8">0</property>
		<property name="FormOptVarScope" vt="Int8">2</property>
		<property name="Resizing" vt="Set"/>
		<property name="PixelsPerInch" vt="Int8">96</property>
		<property name="TextHeight" vt="Int8">13</property>
	</properties>
	<components>
		<object type="TAButton" name="Button1">
			<properties>
				<property name="Left" vt="Int8">8</property>
				<property name="Top" vt="Int8">8</property>
				<property name="Width" vt="Int8">75</property>
				<property name="Height" vt="Int8">25</property>
				<property name="Caption" vt="String">Button1</property>
				<property name="TabOrder" vt="Int8">0</property>
				<property name="Color" vt="Ident">clBtnFace</property>
				<property name="CtrlStyle" vt="Int32">1342373888</property>
				<property name="CtrlExStyle" vt="Int8">0</property>
				<property name="Resizing" vt="Set">DockWidth, DockHeight</property>
			</properties>
			<components/>
		</object>
		<object type="TAInput" name="Input1">
			<properties>
				<property name="Left" vt="Int8">8</property>
				<property name="Top" vt="Int8">40</property>
				<property name="Width" vt="Int8">121</property>
				<property name="Height" vt="Int8">21</property>
				<property name="TabOrder" vt="Int8">1</property>
				<property name="Text" vt="String">Input1</property>
				<property name="CtrlStyle" vt="Int32">1342374016</property>
				<property name="CtrlExStyle" vt="Int16">512</property>
				<property name="Resizing" vt="Set">DockHeight</property>
			</properties>
			<components/>
		</object>
	</components>
</object>

I don't see anything wrong or missing in Koda. Did I say that I use Koda for everything. I use Koda for everything. :D 
2016.09.16koda.png

Edited by argumentum
added the pic. to show where to import from

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

  • Similar Content

    • anusha
      By anusha
      Hi I have jus started using auto-it . Please correct me if I'm wrong.
      I need to read data from an input in text box and search in excel file and return value in next column of matched cell on GUI.
      I have written below code but i cannot use variable which has data stored. it works only when search string is hard coded.
      Please help out.
       
      Example()
      Func Example()
      Local $GuiMain = GUICreate("EXCEL TEST", 399, 180) ;creates main GUI
      ;~ Local $idOK = GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
      Local $iWidthCell = 70
      Local $idLabel = GUICtrlCreateLabel("PART NUMBER", 10, 30, $iWidthCell,50)
      Local $RUN_1 = GUICtrlCreateButton("OK", 70, 70, 85, 25)
      Local $Input_1 = GUICtrlCreateInput("PART NUMBER", 100, 20, 120, 20)
      Local $sMenutext = GUICtrlRead($Input_1, 1)
      GUISetState(@SW_SHOW, $GuiMain)

          While 1
          $MSG = GUIGetMsg()
          Select
              Case $MSG = $GUI_EVENT_CLOSE
                  Exit
              Case $MSG = $RUN_1
                  Local $oAppl = _Excel_Open()

      Local $sFilePath1 = "D:\Anu_WorkFolder\Components.xlsx"
      Local $oWorkbook = _Excel_BookOpen($oAppl, $sFilePath1, Default, Default, True)
      Local $aResult = _Excel_RangeFind($oWorkbook, $sMenutext , Default, Default, $xlWhole)
    • Miliardsto
      By Miliardsto
      Hello.
      Drag option works only on parent window but as we can see on the parent gui is showed up child gui (on the right side with the color).
      Desired action is when we want to drag whole program we can also drag child gui and child gui will drag with parent gui.
      How to do this?
       
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> GUIRegisterMsg($WM_NCHITTEST, "_NCHITTEST") $hGUI = GUICreate("Test", 500, 500, -1, -1) $cButton_0 = GUICtrlCreateButton("Child 0", 10, 10, 80, 30) $cButton_1 = GUICtrlCreateButton("Child 1", 10, 50, 80, 30) $cButton_2 = GUICtrlCreateButton("Child 2", 10, 90, 80, 30) GUISetState(@SW_SHOW, $hGUI) ; guis Global $hChild_[3] Global $countGUI = UBound($hChild_) - 1 ;MsgBox("","",$countGUI) ; licznik dla GUI Global $gui = 0 $hChild_[0] = GUICreate("Child 0", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFF0000) GUISetState(@SW_SHOW, $hChild_[0]) $hChild_[1] = GUICreate("Child 1", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0x00FF00) GUISetState(@SW_HIDE, $hChild_[1]) $hChild_[2] = GUICreate("Child 2", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0x0000FF) GUISetState(@SW_HIDE, $hChild_[2]) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_0 _All_Hide() GUISetState(@SW_SHOW, $hChild_[0]) $gui = 0 Case $cButton_1 _All_Hide() GUISetState(@SW_SHOW, $hChild_[1]) $gui = 1 Case $cButton_2 _All_Hide() GUISetState(@SW_SHOW, $hChild_[2]) $gui = 2 EndSwitch WEnd Func _All_Hide() GUISetState(@SW_HIDE, $hChild_[0]) GUISetState(@SW_HIDE, $hChild_[1]) GUISetState(@SW_HIDE, $hChild_[2]) EndFunc Func _NCHITTEST($hWnd, $uMsg, $wParam, $lParam) If $hWnd = $hGUI Then Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16),0xFFFF)- $aPos[1]) < 500 Then Return $HTCAPTION EndIf Return $GUI_RUNDEFMSG EndFunc  
    • IAMK
      By IAMK
      Hello,
       
      I have a script which uses a GUI with two buttons. It gets shown and hidden., and pressing the buttons (including their hotkeys) highlights the button, making you able to press enter the next time.
      However, I don't want that.
       
      I've tried using WinActivate() to make enter do things on another program, but the enter is still tied to the AutoIT GUI (which still has the button highlighted).
       
      Here's the important part of my code:
      $MY_GUI = GUICreate("Check.exe", 400, 300, ((@DesktopWidth / 2) - 200), -500) WinSetOnTop($MY_GUI, "", 1) ;Keeps the window on the top. $Button1 = GUICtrlCreateButton("Pass (Ctrl+P)", 40, 250, 120, 40, $WS_GROUP) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Fail (Ctrl+F)", 240, 250, 120, 40, $WS_GROUP) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $GUIText = GUICtrlCreateLabel("", 20, 10, 360, 230) GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif") GUICtrlSetData($GUIText, Execute($stepMessage[$step])) $showGUI = "True" GUISetState(@SW_SHOW) While($showGUI = "True") $buttonPressed = GUIGetMsg() Switch $buttonPressed Case $Button1 ;Pass $pass = "True" $buttonPressed = 0 $showGUI = "False" GUISetState(@SW_HIDE) Case $Button2 ;Fail $buttonPressed = 0 $showGUI = "False" GUISetState(@SW_HIDE) While($message = "") $message = InputBox("Check.exe", "Please enter the reason the step failed." & @CRLF, "", "", 300, 200, ((@DesktopWidth / 2) - 150), -400) WEnd Return $message EndSwitch WEnd Local $pass = "False" ;Whether "Pass" or "Fail" was pressed. Local $failLog = xxxfunc($pass) ;Returns a message to log if the step failed. ##THIS CALLS THE CODE SNIPPET ABOVE## FileWrite($file, _Now() & ": Step " & $step & getStatus($pass) & "and took " & Ceiling(TimerDiff($timer) / 1000) & " seconds." & @CRLF) If($failLog <> "") Then FileWrite($file, "Logged comment: " & $failLog & @CRLF) EndIf WinActivate("[TITLE:ProgramName]") ;Hotkeys: HotKeySet("^{p}", "pressPass") HotKeySet("^{f}", "pressFail") Func pressPass() $buttonPressed = $Button1 EndFunc Func pressFail() $buttonPressed = $Button2 EndFunc  
      The GUI's button/hotkey pressing works correctly.
      The same WinActivate code works in another script of mine.
      Together, WinActivate is not take "Active" away from the GUI's last-pressed button. How do I fix this?
       
      Thank you in advance.
    • fatpig
      By fatpig
      Dear AutoIT Community.
      I am currently working on a program that will display lots of images in a scroll down GUI.
      I create the GUI based on the number of images, which works fine.
      But all images I place using GuiCtrlCreatePic above a threshold of around 32000 pixels (cant say exactly) are placed at negative locations and finally will reach 0 again
      and will then populate on top of the images placed there before.
      For $i = 1 To $Images[0] ; Get picture dimensions $hImage = _GDIPlus_ImageLoadFromFile($ImgRep & $Images[$i]) $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) ; Resize & place images in GUI $Pic[$i] = GUICtrlCreatePic($ImgRep & $Images[$i], $Spacer, Round($yPos, 0), $MaxImgWidth, $MaxImgWidth * ($iY / $iX)) $yPos = $yPos + $MaxImgWidth * ($iY / $iX) + $Spacer $log = $log & "|" & $yPos $currentlut = $Images[1] Next I have found a limit at 32767 pixels for some GUI elements when googling around.
      Can someone tell me how to circumvent that?
      thanks!
      cheers
      Felix
    • Shirdish_chakravarthi
      By Shirdish_chakravarthi
      Hello Guys this is my gui and i need the numeric value typed in the highlighted  inputbox. if this value is greater than 1 i need to perform some operations
      \
       
      Here is the summary about that field which i got from wininfo tool

      i tried writing the code as shown below.. but the msgbox is popping up empty value..when the same code is pasted under some button action i am able to access the value present in the field..but when placed alone as written in the attached script i am unable to fetch it... 

      here i am using the valu present in the field

      can you guys tell me what's wrong??? or how can i get that value?
       
      My_GUI.au3