Jump to content

another small help please :D


Healian
 Share

Recommended Posts

its working !!!!!!!!!!!!!!!!!1 thank you very much Melba23 without you help i wasnt made it thank you autoit and love autoit forum ... sorry JOS i was only asking but wasnt know the laws of the forum and did not know what is the meaning of shoutin in text ?

Edited by Healian
Link to comment
Share on other sites

  • Moderators

Healian,

Use something like this to get the handle of the combo:

$hApp = WinGetHandle("App_Title")
$hComboHandle = ControlGetHandle($hApp, "", "[CLASS:Combo_Class;INSTANCE:Combo_Instance]") ; Get the CLASS and INSTANCE values with the Window Info tool

And then use the _GUICtrlCombo_* commands to do what you will with the combo. Something along these lines should work:

; Select the item
_GUICtrlComboBox_SetCurSel($hCntl, 5) ; Use the index of the item you want to select
; Tell Windows you have selected something
$iCode = BitShift($CBN_SELCHANGE, -16)
_SendMessage($hApp, $WM_COMMAND, $iCode, $hCombo)

Have fun! :graduated:

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

Healian,

First, use the 'AutoIt Window Info Tool' aka 'Au3Info.exe' to find the control you wish to automate.

Then use ControlCommand() with command "SelectString", 'string' to automate the control.

If you have any further questions feel free to post here again, however make sure you include information on the control that you find with 'AutoIt Window Info Tool', and what code you have so far, or atleast an example of it.

Realm

Edit: Guess was already answered, took me too long to reply Posted Image

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

@Melba23 - Does _GUICtrlComboBox_SetCurSel() work on apps outside of your script? I always assumed that would only work on your own scripts.

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

  • Moderators

Realm,

The GUICtrl* (without a leading underscore) commands only work on AutoIt native controls - those created with the GUICtrlCreate* commands.

But the UDF commands (with a leading underscore) should work on any control of the related type - as long as they were created with the the standard Windows API. After all the controls created by the UDF are standard Windows controls - which is why the return values are handles and not ControlIDs.

I have often used the various UDF functions to interact with external apps - in fact many of the Help file examples do just that, look at _GUICtrlMenu_GetMenu for instance! :graduated:

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

Healian,

First, in the 'Window Info Tool' and on the bottom is an EditBox with tabs, click the 'Control' Tab, and replace this information:

Title is found in the 'Basic Window Info'

Leave 'SelectString' as it is.

ControlCommand('Title','','ClassnameNN',"SelectString", 'The text of the selection you wish to choose')

If you are still having problems, then repost with a paste of the information you find with the 'Window Info Tool'

Realm

Edit:

@Melba - Thanks, I never knew it. *scratching chin* That gives me some ideas Posted Image

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

melba i am trying with your way but i typed instead of "5" in instance like this

$insnum = inputbox ("enter number","enter number")

_GUICtrlComboBox_SetCurSel($hCntl, $insnum)

but it says variable used without being declared

and tried to remove $insum and added the instnce and again variable used without being declared

$hApp = WinGetHandle("title of the window")
$hComboHandle = ControlGetHandle($hApp, "", "[CLASS:ThunderRT6ComboBox;INSTANCE:3]") ; Get the CLASS and INSTANCE values with the Window Info tool
; Select the item
_GUICtrlComboBox_SetCurSel($hCntl,28) ; Use the index of the item you want to select
Edited by Healian
Link to comment
Share on other sites

  • Moderators

Healian,

What variable is not declared? Please post all the code you are using. :graduated:

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

$servernum = IniRead(@ScriptDir & "\config.ini", "server", 4, "")
If $servernum = "" Then
    $servernum = inputbox ("Enter your server number","Enter your server number (A list with server numbers is included")
endif
    IniWrite(@ScriptDir & "\config.ini", "server", 4, $servernum)
run ("program")
$hApp = WinGetHandle("PROGRAM TITLE")
$hComboHandle = ControlGetHandle($hApp, "", "[CLASS:ThunderRT6ComboBox;INSTANCE:3]") ; Get the CLASS and INSTANCE values with the Window Info tool
; Select the item
_GUICtrlComboBox_SetCurSel($hCntl,28) ; Use the index of the item you want to select
; Tell Windows you have selected something
$iCode = BitShift($CBN_SELCHANGE, -16)
_SendMessage($hApp, $WM_COMMAND, $iCode, $hCombo)

AND IT SAYS VARIABLE USED WITHOUT BEING DECLARED

Edited by Healian
Link to comment
Share on other sites

I can see this vaiable was never defined (at least in what you posted)

_GUICtrlComboBox_SetCurSel($hCntl <---

*edit*

and if it were me, I would put the iniwrite before the endif so it only writes to the ini if there wasn't a previous value.

As it stands, it reads the value, then writes it back in.

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

$servernum = IniRead(@ScriptDir & "\config.ini", "server", 4, "")
If $servernum = "" Then
    $servernum = inputbox ("Enter your server number","Enter your server number (A list with server numbers is included")
endif
    IniWrite(@ScriptDir & "\config.ini", "server", 4, $servernum)
run ("program")
$hApp = WinGetHandle("PROGRAM TITLE")
$hComboHandle = ControlGetHandle($hApp, "", "[CLASS:ThunderRT6ComboBox;INSTANCE:3]") ; Get the CLASS and INSTANCE values with the Window Info tool
; Select the item
_GUICtrlComboBox_SetCurSel($hCntl,28) ; Use the index of the item you want to select
; Tell Windows you have selected something
$iCode = BitShift($CBN_SELCHANGE, -16)
_SendMessage($hApp, $WM_COMMAND, $iCode, $hCombo)

AND IT SAYS VARIABLE USED WITHOUT BEING DECLARED

Link to comment
Share on other sites

  • Moderators

Healian,

AND IT SAYS VARIABLE USED WITHOUT BEING DECLARED

Do you remember what Jos said here? Please stop shouting. :D

There are a whole bunch of things which are not declared in that script. I should have been clearer in my earlier post but I gave you credit for knowing a little about AutoIt - it seems I was mistaken. :(

So let us take them one by one:

$hCntl and $hCombo - You need to use $hComboHandle here.

_GUICtrlComboBox_SetCurSel and $CBN_SELCHANGE - Put #Include <GuiComboBox.au3> at the top of your script - you need that to run the function and it will give you the message value as well.

$WM_COMMAND - Put #Include <WindowsConstants.au3> at the top of your script - that include file will give you this variable.

_SendMessage() - Put #Include <SendMessage.au3> at the top of your script - that include file will give you this function.

So your code should read:

#Include <WindowsConstants.au3>
#Include <GuiComboBox.au3>
#Include <SendMessage.au3>

$servernum = IniRead(@ScriptDir & "\config.ini", "server", 4, "")
If $servernum = "" Then
    $servernum = InputBox("Enter your server number", "Enter your server number (A list with server numbers is included")
EndIf

IniWrite(@ScriptDir & "\config.ini", "server", 4, $servernum)

Run("program")

$hApp = WinGetHandle("PROGRAM TITLE")
$hComboHandle = ControlGetHandle($hApp, "", "[CLASS:ThunderRT6ComboBox;INSTANCE:3]") ; Get the CLASS and INSTANCE values with the Window Info tool
; Select the item
_GUICtrlComboBox_SetCurSel($hComboHandle, 28) ; Use the index of the item you want to select
; Tell Windows you have selected something
$iCode = BitShift($CBN_SELCHANGE, -16)
_SendMessage($hApp, $WM_COMMAND, $iCode, $hComboHandle)

When I syntax check that, I get no errors. :graduated:

Now I would very strongly suggest that before you do any more coding, you learn a bit more about how Autoit is structured - things like #include files, for example.

Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading.

I know you want to start coding NOW, but a little study will save you (and us :D ) a lot of trouble later on, believe me.

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

Healian,

THIS IS SHOUTING and it is considered rude, which is why Jos asked you not to do it. :graduated:

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

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