Jump to content
Sign in to follow this  
Toysan

Simple for you ? Not simple for me T_T

Recommended Posts

Toysan

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.

Share this post


Link to post
Share on other sites
Toysan

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

Share this post


Link to post
Share on other sites
Digisoul

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

Share this post


Link to post
Share on other sites
Tripredacus

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

This wouldn't be for a game like Witcher 2, would it? :rip:

Share this post


Link to post
Share on other sites
Valik

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?

  • Like 1

Share this post


Link to post
Share on other sites
Valik

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.

Share this post


Link to post
Share on other sites
Attckdog

Posting in locked thread.

Posted Image

I must have picked the lock !


A true renaissance man

Share this post


Link to post
Share on other sites
Valik

Hmm. Not the first thread I had issues locking today.

Share this post


Link to post
Share on other sites
Valik

Seems to be really locked this time... I hope.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.