Jump to content

Recommended Posts

Posted

Hello

I want to learn how to edit the code, by using GUI. I write this code(i use autoit for a week, don't blame me) for example.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("Coords", 32, 16, 81, 21)
$Input2 = GUICtrlCreateInput("Color", 128, 16, 81, 21)
$Radio1 = GUICtrlCreateRadio("PGUP", 40, 200, 113, 17)
$Checkbox1 = GUICtrlCreateCheckbox("", 40, 232, 97, 17)
$Button1 = GUICtrlCreateButton("Change", 32, 40, 57, 17)
$Button2 = GUICtrlCreateButton("Change", 128, 40, 49, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch

WEnd

MouseMove ( 1010, 361, [10] )
sleep(500)
$test = (PixelSearch(754, 326, 1454, 743, 0x3396D8))
MouseClick("left", $test[0], $test[1], 1, 1)
sleep(600)
MouseMove ( x, y [, speed = 10] )
sleep(500)
Send ( "{PGUP}" ,0 )

I want to learn how change MouseMove ( 1010, 361, [10] ) coordinates, by using Input1 + button1.

$test = (PixelSearch(754, 326, 1454, 743, 0x3396D8)) i want to change for different color by using input2+ button2

and the last thing, how to change Send ( "{PGUP}" ,0 ) to PGDOWN by clicking on radiobox or checkbox.

Can someone tell me how to begin work with it? 

 

Sorry for my bad english.

Posted

You'll want to create a structure with functions that act on the press of those buttons to read the input and translate that to a variable, to be then used in the mouseclick and whatnot. Same for the color, the issue will be you separating the coordinates, i would create another input, one for X other for Y.

As for the pgup pgdn, that's easy enough too. We'll get to that later.

here's a sample, so you can try to figure it out.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
;#AutoIt3Wrapper_Icon=.ico
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Comment=By:
;#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_Res_SaveSource=y
;#AutoIt3Wrapper_Res_Icon_Add=.ico
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;=============================================================================
#Region ;Include + Opt
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <TrayConstants.au3>
Opt("TrayMenuMode", 3)
Opt("TrayIconHide", 0)
Opt("GUIResizeMode", 1)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 2)
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 0)
Opt("GUIEventOptions", 1)
Opt("TrayOnEventMode", 0)
Opt("ExpandEnvStrings", 1)
Opt("WinDetectHiddenText", 1)
#EndRegion ;Include + Opt
;=============================================================================
#Region ;GuiVars
Local $GUI, $Frm_main, $Button1, $Button2, $Input1, $Input2, $Radio1, $Checkbox1, $ReadIP1
;TrayVars
Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem
;MiscVars
Local $Au3filesArray, $Msg, $txt, $Reg, $RegTrim
#EndRegion ;GuiVars
;=============================================================================
#Region ;GUI
TraySetIcon("ico.ico")
$GUI = GUICreate("Form1", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("Coords", 32, 16, 81, 21)
$Input2 = GUICtrlCreateInput("Color", 128, 16, 81, 21)
$Radio1 = GUICtrlCreateRadio("PGUP", 40, 200, 113, 17)
$Checkbox1 = GUICtrlCreateCheckbox("", 40, 232, 97, 17)
$Button1 = GUICtrlCreateButton("Change", 32, 40, 57, 17)
GUICtrlSetOnEvent($Button1, "ChangeCoords") ;Jump to function at press
$Button2 = GUICtrlCreateButton("Change", 128, 40, 49, 17)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Restore")
$ExitItem = TrayCreateItem("Close")
TrayItemSetOnEvent(-1, "Quit")
GUISetState()
TraySetState(1)
TraySetClick(8)
#EndRegion ;GUI
;=============================================================================
Do ;Main
    Sleep(100)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;=============================================================================
Func ChangeCoords()
    $ReadIP1 = GUICtrlRead($Input1) ;Get the text on the input
    MsgBox(64, 'Result', $ReadIP1)
EndFunc   ;==>ChangeCoords
;=============================================================================
#Region ;Window
Func Minimize()
    WinSetState('', '', @SW_MINIMIZE)
EndFunc   ;==>Minimize
Func Restore()
    WinSetState('', '', @SW_RESTORE)
EndFunc   ;==>Restore
Func Quit()
    Exit
EndFunc   ;==>Quit
#EndRegion ;Window
;=============================================================================

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
9 hours ago, careca said:

You'll want to create a structure with functions that act on the press of those buttons to read the input and translate that to a variable, to be then used in the mouseclick and whatnot. Same for the color, the issue will be you separating the coordinates, i would create another input, one for X other for Y.

As for the pgup pgdn, that's easy enough too. We'll get to that later.

here's a sample, so you can try to figure it out.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
;#AutoIt3Wrapper_Icon=.ico
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Comment=By:
;#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_Res_SaveSource=y
;#AutoIt3Wrapper_Res_Icon_Add=.ico
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;=============================================================================
#Region ;Include + Opt
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <TrayConstants.au3>
Opt("TrayMenuMode", 3)
Opt("TrayIconHide", 0)
Opt("GUIResizeMode", 1)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 2)
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 0)
Opt("GUIEventOptions", 1)
Opt("TrayOnEventMode", 0)
Opt("ExpandEnvStrings", 1)
Opt("WinDetectHiddenText", 1)
#EndRegion ;Include + Opt
;=============================================================================
#Region ;GuiVars
Local $GUI, $Frm_main, $Button1, $Button2, $Input1, $Input2, $Radio1, $Checkbox1, $ReadIP1
;TrayVars
Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem
;MiscVars
Local $Au3filesArray, $Msg, $txt, $Reg, $RegTrim
#EndRegion ;GuiVars
;=============================================================================
#Region ;GUI
TraySetIcon("ico.ico")
$GUI = GUICreate("Form1", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("Coords", 32, 16, 81, 21)
$Input2 = GUICtrlCreateInput("Color", 128, 16, 81, 21)
$Radio1 = GUICtrlCreateRadio("PGUP", 40, 200, 113, 17)
$Checkbox1 = GUICtrlCreateCheckbox("", 40, 232, 97, 17)
$Button1 = GUICtrlCreateButton("Change", 32, 40, 57, 17)
GUICtrlSetOnEvent($Button1, "ChangeCoords") ;Jump to function at press
$Button2 = GUICtrlCreateButton("Change", 128, 40, 49, 17)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Restore")
$ExitItem = TrayCreateItem("Close")
TrayItemSetOnEvent(-1, "Quit")
GUISetState()
TraySetState(1)
TraySetClick(8)
#EndRegion ;GUI
;=============================================================================
Do ;Main
    Sleep(100)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;=============================================================================
Func ChangeCoords()
    $ReadIP1 = GUICtrlRead($Input1) ;Get the text on the input
    MsgBox(64, 'Result', $ReadIP1)
EndFunc   ;==>ChangeCoords
;=============================================================================
#Region ;Window
Func Minimize()
    WinSetState('', '', @SW_MINIMIZE)
EndFunc   ;==>Minimize
Func Restore()
    WinSetState('', '', @SW_RESTORE)
EndFunc   ;==>Restore
Func Quit()
    Exit
EndFunc   ;==>Quit
#EndRegion ;Window
;=============================================================================

 

 

2 hours ago, Jos said:

@Viperking123,

How is this one different from this closed thread?

You did read and understand the Forum rules you were pointed to?

Jos

I was writing with moderator on pw, he told me my mistakes :) I just want to learn that thing.

Posted
9 hours ago, careca said:

You'll want to create a structure with functions that act on the press of those buttons to read the input and translate that to a variable, to be then used in the mouseclick and whatnot. Same for the color, the issue will be you separating the coordinates, i would create another input, one for X other for Y.

As for the pgup pgdn, that's easy enough too. We'll get to that later.

here's a sample, so you can try to figure it out.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
;#AutoIt3Wrapper_Icon=.ico
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Comment=By:
;#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_Res_SaveSource=y
;#AutoIt3Wrapper_Res_Icon_Add=.ico
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;=============================================================================
#Region ;Include + Opt
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <TrayConstants.au3>
Opt("TrayMenuMode", 3)
Opt("TrayIconHide", 0)
Opt("GUIResizeMode", 1)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 2)
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 0)
Opt("GUIEventOptions", 1)
Opt("TrayOnEventMode", 0)
Opt("ExpandEnvStrings", 1)
Opt("WinDetectHiddenText", 1)
#EndRegion ;Include + Opt
;=============================================================================
#Region ;GuiVars
Local $GUI, $Frm_main, $Button1, $Button2, $Input1, $Input2, $Radio1, $Checkbox1, $ReadIP1
;TrayVars
Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem
;MiscVars
Local $Au3filesArray, $Msg, $txt, $Reg, $RegTrim
#EndRegion ;GuiVars
;=============================================================================
#Region ;GUI
TraySetIcon("ico.ico")
$GUI = GUICreate("Form1", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("Coords", 32, 16, 81, 21)
$Input2 = GUICtrlCreateInput("Color", 128, 16, 81, 21)
$Radio1 = GUICtrlCreateRadio("PGUP", 40, 200, 113, 17)
$Checkbox1 = GUICtrlCreateCheckbox("", 40, 232, 97, 17)
$Button1 = GUICtrlCreateButton("Change", 32, 40, 57, 17)
GUICtrlSetOnEvent($Button1, "ChangeCoords") ;Jump to function at press
$Button2 = GUICtrlCreateButton("Change", 128, 40, 49, 17)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Restore")
$ExitItem = TrayCreateItem("Close")
TrayItemSetOnEvent(-1, "Quit")
GUISetState()
TraySetState(1)
TraySetClick(8)
#EndRegion ;GUI
;=============================================================================
Do ;Main
    Sleep(100)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;=============================================================================
Func ChangeCoords()
    $ReadIP1 = GUICtrlRead($Input1) ;Get the text on the input
    MsgBox(64, 'Result', $ReadIP1)
EndFunc   ;==>ChangeCoords
;=============================================================================
#Region ;Window
Func Minimize()
    WinSetState('', '', @SW_MINIMIZE)
EndFunc   ;==>Minimize
Func Restore()
    WinSetState('', '', @SW_RESTORE)
EndFunc   ;==>Restore
Func Quit()
    Exit
EndFunc   ;==>Quit
#EndRegion ;Window
;=============================================================================

 

Thank u, i don't understand it right now, but i will try :)

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
  • Recently Browsing   0 members

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