Jump to content

Recommended Posts

Posted

I was trying to write simple GUI program with using. But thats too harsh for me and as more I read about AutoIt as less I knew from it 0.o

My idea was to cr8t simple program which when I click START button then:

1. it presses (NOT holds) num 9

2. wait 0.5s

3. it presses (NOT holds) num 8

4. wait 4s

and reapeats whole actions from 1 to 4 till I Click STOP button.

If someone would think that, I want to use someone than belive me I am not, I am still trying to cr8t it with AutoIt tool called Koda (version 1.7.3.0) but with TOTALLY shitty progress T-T. I was simply not born for scripting.. So plz someone help.

Posted

Here is a code I Made, To show how does my window looks like...

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

Global $Form1 = GUICreate("Auto 8,9", 301, 101, 313, 303)

GUISetBkColor(0xFFFF00)

Global $Button1 = GUICtrlCreateButton("START", 24, 24, 113, 41)

GUICtrlSetBkColor($Button1, 0x00FF00)

Global $Button2 = GUICtrlCreateButton("STOP", 184, 24, 113, 41)

GUICtrlSetBkColor($Button2, 0xFF0000)

Global $Pic1 = GUICtrlCreatePic("C:UsersAdminDocumentsautosave_0069_640x360.bmp", 0, 0, 300, 100)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

But still I do not know how to make main START and STOP part

Posted

  On 7/17/2012 at 4:39 PM, 'Toysan said:

Here is a code I Made, To show how does my window looks like...

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

Global $Form1 = GUICreate("Auto 8,9", 301, 101, 313, 303)

GUISetBkColor(0xFFFF00)

Global $Button1 = GUICtrlCreateButton("START", 24, 24, 113, 41)

GUICtrlSetBkColor($Button1, 0x00FF00)

Global $Button2 = GUICtrlCreateButton("STOP", 184, 24, 113, 41)

GUICtrlSetBkColor($Button2, 0xFF0000)

Global $Pic1 = GUICtrlCreatePic("C:UsersAdminDocumentsautosave_0069_640x360.bmp", 0, 0, 300, 100)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

But still I do not know how to make main START and STOP part

#include 
#include 
#include 
#include 
#region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Auto 8,9", 301, 101, 313, 303)
GUISetBkColor(0xFFFF00)
Global $Button1 = GUICtrlCreateButton("START", 24, 24, 113, 41)
GUICtrlSetBkColor($Button1, 0x00FF00)
Global $Button2 = GUICtrlCreateButton("STOP", 184, 24, 113, 41)
GUICtrlSetBkColor($Button2, 0xFF0000)
GUICtrlSetState($Button2,$GUI_DISABLE)

Global $Pic1 = GUICtrlCreatePic("C:UsersAdminDocumentsautosave_0069_640x360.bmp", 0, 0, 300, 100)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

Global $workStatus = False, $Timer, $Mode = 1, $INIT = False

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
ConsoleWrite("Start Button Pressed!" & @LF)
$INIT = True
$workStatus = True
GUICtrlSetState($Button1,$GUI_DISABLE)
GUICtrlSetState($Button2,$GUI_ENABLE)
Case $Button2
ConsoleWrite("Stop Button Pressed!" & @LF)
$workStatus = False
GUICtrlSetState($Button2,$GUI_DISABLE)
GUICtrlSetState($Button1,$GUI_ENABLE)
EndSwitch

If $workStatus = True Then
Switch $Mode
Case 1; Press 9
If $INIT = False Then
If TimerDiff($Timer) < 500 Then ContinueLoop; 0.5 Sec
ElseIf $INIT = True Then
$INIT = False
EndIf
;====================
Send("{9}")
$Mode = 2
$Timer = TimerInit()
Case 2
If TimerDiff($Timer) >= 4000 Then ; 4 Sec
Send("{8}")
$Mode = 1
$Timer = TimerInit()
EndIf
EndSwitch
EndIf
WEnd

:)

73 108 111 118 101 65 117 116 111 105 116

Posted

That is a rather suspicious file name. I didn't play The Witcher 2 much after I bought it so I'm struggling to come up with why somebody would want to automate it.

That said, I'm incredibly tempted to lock this thread just because the OP keeps using "cr8t" instead of "create". The post uses capitalization and punctuation but interjects that English murder into it?

Posted

I was going to give the user a chance to respond but apparently they got their answer and won't be back until they have another question. Thread locked so I can close the report.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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