Sign in to follow this  
Followers 0
Xink

help need with a script

6 posts in this topic

Hello,

Ik have 2 issues with writing a script.

Issue1:

The window has 3 inputboxes and 3 (search) buttons next the inputboxes.

When the user enter data into one of the inputbox and press enter, it must be pressed the button next this inputbox.

Ik have tried to use HotKeySet function with the check GUIGetCursorInfo which inputbox the cursor is, but still having problems.

Issue2:

The window has a listbox with data in it.

When the user click on one of the item in the listbox, it must perform an action.

Before this i had a button the user can click on it to perform this action, but now i have remove this button because it's an extra click that isn't neccessary.

Any help are appreciated,

regards,

Xink

Share this post


Link to post
Share on other sites



Issue1:

When the user entered data into one of the inputbox and press enter, the script must know which inputbox is modified and press the button next this inputbox

CODE
#include <GUIConstants.au3>

HotkeySet("{Enter}", "GetCursor")

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

$AForm1 = GUICreate("AForm1", 265, 181, 383, 248)

GUICtrlCreateInput("", 24, 24, 137, 21)

$Button1 = GUICtrlCreateButton("Search", 168, 24, 57, 25, 0)

GUICtrlCreateInput("", 24, 72, 137, 21)

$Button2 = GUICtrlCreateButton("Search", 168, 72, 57, 25, 0)

GUICtrlCreateInput("", 24, 120, 137, 21)

$Button3 = GUICtrlCreateButton("Search", 168, 120, 57, 25, 0)

GUISetState(@SW_SHOW)

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

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

;Do action 1

Case $Button2

;Do action 2

Case $Button3

;Do action 3

EndSwitch

WEnd

Func GetCursor()

;Find out in which inputbox the cursor is now and press the search button next the inputbox

EndFunc

Issue2:

When the user clicks on one of the item in the listbox, it must automatically launch the button1 without actually clicking on the button1.

CODE
#include <GUIConstants.au3>

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

$AForm1 = GUICreate("AForm1", 324, 277, 382, 186)

$List1 = GUICtrlCreateList("", 24, 24, 177, 227)

GuiCtrlSetData($List1, "test1|test2|Test3|Test4|Test5|Test6")

$Button1 = GUICtrlCreateButton("Button1", 224, 32, 73, 33, 0)

GUISetState(@SW_SHOW)

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

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

;Do action

EndSwitch

WEnd

Share this post


Link to post
Share on other sites

Issue1:

When the user entered data into one of the inputbox and press enter, the script must know which inputbox is modified and press the button next this inputbox

Issue1 fixed:

heres code

#include <GUIConstants.au3>
HotkeySet("{Enter}", "GetCursor1")
$I1q = ""
$I2q = ""
$I3q = ""
#Region ### START Koda GUI section ### Form=
$AForm1 = GUICreate("AForm1", 265, 181, 383, 248)
$I1 = GUICtrlCreateInput("", 24, 24, 137, 21)
$Button1 = GUICtrlCreateButton("Search", 168, 24, 57, 25, 0)
$I2 = GUICtrlCreateInput("", 24, 72, 137, 21)
$Button2 = GUICtrlCreateButton("Search", 168, 72, 57, 25, 0)
$I3 = GUICtrlCreateInput("", 24, 120, 137, 21)
$Button3 = GUICtrlCreateButton("Search", 168, 120, 57, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
;Do action 1
Case $Button2
;Do action 2
Case $Button3
;Do action 3
EndSwitch
WEnd


Func GetCursor1()
If GUICtrlRead($I1) == $I1q Then
    MsgBox(1024, "Correct", "Inputbox one has been not edited")
Else
    MsgBox(1024, "Error", "Inputbox one has been edited")
EndIf
GetCursor2()
EndFunc


Func GetCursor2()
    If GUICtrlRead($I2) == $I2q Then
            MsgBox(1024, "Correct", "Inputbox two has been not edited")
Else
    MsgBox(1024, "Error", "Inputbox two has been edited")
EndIf
GetCursor3()
EndFunc


Func GetCursor3()
If GUICtrlRead($I3) == $I3q Then
            MsgBox(1024, "Correct", "Inputbox three has been not edited")
Else
    MsgBox(1024, "Error", "Inputbox three has been edited")
EndIf
EndFunc

ill have a look at issue 2 now...

Share this post


Link to post
Share on other sites

Hello ashley,

Thank you for your fast reply, sorry i forgot to mention 1 thing.

At issue1: user can edit text in input1 and press enter, but after that, user can also edit text in input2 (for another search)

The text in input1 is still there, the script must then ignore input1 and only search for input2. (only 1 at a time)

When the user edit input1 and also edit input2 and press enter, the script must only run the input where the cursor reside.

I have tried the GUIGetCursorInfo function, but don't know how to get the return code of the cursor in which inputbox.

Share this post


Link to post
Share on other sites

Hello ashley,

Thank you for your fast reply, sorry i forgot to mention 1 thing.

At issue1: user can edit text in input1 and press enter, but after that, user can also edit text in input2 (for another search)

The text in input1 is still there, the script must then ignore input1 and only search for input2. (only 1 at a time)

When the user edit input1 and also edit input2 and press enter, the script must only run the input where the cursor reside.

I have tried the GUIGetCursorInfo function, but don't know how to get the return code of the cursor in which inputbox.

ok take out the functions inside the functions... and make hotkeys for each input box...

easy

Share this post


Link to post
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
Sign in to follow this  
Followers 0