Jump to content

GUICtrlRead returns 0


Recommended Posts

Hi, I just can't see why GUICtrlRead doesn't read the input text from

$texttest = GUICtrlRead($Offender[$index])

_ArrayDisplay ($Offender) - this displays the array with all the controls

Help please?

#include <ButtonConstants.au3>

#include <ComboConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <TabConstants.au3>

#include <WindowsConstants.au3>

#include <ScreenCapture.au3>

#include <array.au3>

#include <GuiTab.au3>

#NoTrayIcon

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

$Form1 = GUICreate("Ban Poster", 912, 641, 192, 132)

$Tab1 = GUICtrlCreateTab(0, 0, 921, 33)

$Room = GUICtrlCreateCombo("RHLR 1", 736, 208, 169, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))

GUICtrlSetData(-1, "RHLR 2|RHLR 3|RHLR 4|RHLR 5|RHLR 6|RHLR 7")

$Label1 = GUICtrlCreateLabel("Ник нарушителя:", 8, 42, 170, 30)

GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x000000)

$Label2 = GUICtrlCreateLabel("Комната:", 736, 176, 63, 20)

$OpenScreen = GUICtrlCreateButton("Открыть", 592, 60, 137, 25)

$Pic1 = GUICtrlCreatePic(@ScriptDir &amp; 'banned.jpg', 736, 253, 169, 100)

Opt("TrayMenuMode", "1")

HotKeySet("{PRINTSCREEN}", "PRINTSCREEN")

$exit = TrayCreateItem("Выход")

TraySetState()

$tabs = 0

Global $tabA[1], $Screen[1], $ScreenName[1], $Offender[1]

While 1

$msg = TrayGetMsg ()

If $msg = $exit Then Exit

$guimsg = GUIGetMsg()

Select

Case $guimsg = $pic1

$current=GUICtrlRead ($Tab1,1 )

$index = _GUICtrlTab_GetCurSel($Tab1)

$index+=1

MsgBox (0,"test", $index)

GUICtrlDelete ($current)

$tabs -=1

If $tabs=0 Then

GUISetState(@SW_HIDE)

EndIf

ConsoleWrite (@CRLF&amp;$index)

_ArrayDisplay ($Offender)

$texttest = GUICtrlRead($Offender[$index])

$texttest2 = GUICtrlRead($screenname[$index])

ConsoleWrite (@CRLF&amp;$texttest&amp;@CRLF&amp;$texttest2)

_ArrayDelete ($tabA, $index+1)

_ArrayDelete ($screen, $index+1)

_ArrayDelete ($screenname, $index+1)

_ArrayDelete ($offender, $index+1)

; Remove the tab AND the edit from the arrays

; Remove the tab

Case $guimsg = $GUI_EVENT_CLOSE

Exit

EndSelect

Wend

Func PrintScreen ()

;If WinActive ("Warcraft III") Then

$name = @YEAR &amp; @MON &amp; @MDAY &amp; @HOUR &amp; @MIN &amp; @SEC

_ScreenCapture_Capture(@ScriptDir&amp;"screens"&amp;$name&amp;".jpg")

$tabs +=1

ReDim $tabA [$tabs+1]

ReDim $Screen [$tabs+1]

ReDim $ScreenName [$tabs+1]

ReDim $Offender [$tabs+1]

$tabA[$tabs]=GUICtrlCreateTabItem("Реквест")

$Screen [$tabs] = GUICtrlCreatePic(@ScriptDir&amp;"screens"&amp;$name&amp;".jpg", 8, 88, 721, 545)

$ScreenName [$tabs] = GUICtrlCreateLabel($name&amp;".jpg", 610, 40, 150, 20)

$Offender [$tabs] = GUICtrlCreateInput("", 180, 45, 177, 24)

GUICtrlCreateTabItem("")

;$Button1 = GUICtrlCreateButton("Button1", 736, 533, 169, 100)

GUISetState(@SW_SHOW)

;EndIf

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

EndFunc

Edited by tsolrm
Link to comment
Share on other sites

heh... i don't see a control defined as $Offender anywhere in your code.

You created an edit.

Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • Moderators

;If WinActive ("Warcraft III") Then

$name = @YEAR &amp; @MON &amp; @MDAY &amp; @HOUR &amp; @MIN &amp; @SEC

_ScreenCapture_Capture(@ScriptDir&amp;"screens"&amp;$name&amp;".jpg")

Hi, tsolm. Please see the forum rules, particularly the bit about game automation. You will see why you will not receive any help.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

tsolrm,

If WinActive ("Warcraft III")

Care to offer an explanation? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

My god people, why are u so paranoid. This has nothing to do with game automation, in fact i don't see how u could possibly automate Warcraft 3.

How exactly capturing a screen shot automates the game?

Link to comment
Share on other sites

His code shows that all he's doing is taking and indexing screenshots. However it is for a game.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Create a few tabs with the PrintScreen button and then click on the picture, it will work correctly. Otherwise there's nothing in the Offender array yet.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I've tried creating 3-4 tabs. $Offender[$index] and $ScreenName[$index] returns 0 for all. Even though the actual array $Offender exists and holds the numbers of the controls and $index returns a valid index for the tab

Edited by tsolrm
Link to comment
Share on other sites

  • Moderators

tsolrm,

My god people, why are u so paranoid

Because experience has, alas, taught me to be so. ;(

And why reply so aggressively? You will note that I did not lock the thread nor accuse you of anything. All I asked for was an explanation of why there was reference to a game in your script. Blasting off like you did does your case no good at all. :naughty:

I am sorely tempted to react to your attitude, but then I would be guilty of the same offence. So please try and be more civil in future and make the forum a more pleasant place for us all. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

tsolrm,

Well I am sorry for the attitude

Apology accepted. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I don't know what to do. after the input box is created i've added this code

GUICtrlSetData ($Offender [$tabs], "test")

$texttest = GUICtrlRead($Offender[$tabs])

ConsoleWrite (@CRLF&$Offender [$tabs]&@CRLF&$texttest)

In the console it shows

12

test

Now without touching anything else

$texttest = GUICtrlRead($Offender[$index])

ConsoleWrite (@CRLF&$Offender[$index])

ConsoleWrite (@CRLF&$texttest&@CRLF&$texttest2)

this gives

12

0

I must be missing something. This is driving me nuts

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...