Sign in to follow this  
Followers 0
kokoilie

Is there a way to make gui combo scrolling in win10 easier?

3 posts in this topic

#1 ·  Posted

I'm making a program that has a combo control in a gui and back in win7 when the window was focused the scroll wheel could be used to scroll through it's contents, now i'm using win10 and i have to put the mouse on that control to scroll up and down.
Since now the scroll wheel works depending on where the mouse is, is there a way to make it no matter where on the gui the pointer is?
Also if the only way to do it is some complex hotkey functions will it work with pressing space to toggle a checkbox?
If you need to see what i have so far let me know and i'll copy it here.

Share this post


Link to post
Share on other sites



#2 ·  Posted

@kokoilie

Hi and welcome to the AutoIt forum :)

When you ask for help, you should always what you did, in order to correct you ( if necessary ) or point you in the right direction :)

Show us what you did, and I think a lot of people would help you with your question :)


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#3 ·  Posted

ok here it is
 

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Crypt.au3>
Global $dir, $exe ;system
Global $cstart, $cmanage, $clist, $cexe, $crealm, $ccheck, $cserv ;main gui
Global $cadd1, $cadd2, $cremove1, $cremove2, $clist1, $clist2 ;acc manage gui
Global $count, $counts, $i, $list, $acc, $realm, $serv, $f, $key, $acci, $passi, $bad ;internal
$key = InputBox ("Decyption key", "Please input a incryption/decryption key.", "", "*M", 285, 180)
If $key = "" Then Exit
init()
make_main_window ()
Func make_main_window ()
    GUICreate ("Autologin",285 ,150)
    $clist = GUICtrlCreateCombo ("", 10, 10, 265, 20)
    $cstart = GUICtrlCreateButton ("Start", 10, 35, 50, 20, 0x0001)
    $cmanage = GUICtrlCreateButton ("Manage Accs", 65, 35, 80, 20)
    $cexe = GUICtrlCreateButton ($exe, 150, 35, 100, 20)
    GUICtrlCreateLabel ("Realmlist content", 10, 65, 100, 20)
    $crealm = GUICtrlCreateInput ($realm, 10, 80, 265, 20)
    $cserv = GUICtrlCreateCombo ("", 10, 110, 265, 20)
    $ccheck = GUICtrlCreateCheckbox ("", 255, 35, 20, 20)
    main_params ()
    GUISetState(@SW_SHOW)
    loop_main_window ()
EndFunc
Func loop_main_window ()
    While 1
        Switch GUIGetMsg ()
            Case $GUI_EVENT_CLOSE
                Exit
            Case $cstart
                $read = GUICtrlRead ($cserv)
                ;If $read <> $realm Then
                ;   If $realm = "Realmlist not found" Then start ()
                ;   $f = FileOpen ("data\engb\realmlist.wtf", 2)
                ;   FileWrite ($f, "set realmlist "&$read)
                ;   FileClose ($f)
                ;EndIf
                start ()
            Case $cexe
                manageexe ()
            Case $cmanage
                GUIDelete()
                make_acc_window ()
                loop_acc_window ()
        EndSwitch
    WEnd
EndFunc
Func make_acc_window ()
    GUICreate ("Accounts and servers",285 ,150)
    $cadd1 = GUICtrlCreateButton ("Add", 10, 10, 50, 20)
    $cadd2 = GUICtrlCreateButton ("Add", 145, 10, 50, 20)
    $cremove1 = GUICtrlCreateButton ("Remove", 65, 10, 50, 20)
    $cremove2 = GUICtrlCreateButton ("Remove", 200, 10, 50, 20)
    $clist1 = GUICtrlCreateList ("", 10, 35, 130, 105)
    $clist2 = GUICtrlCreateList ("", 145, 35, 130, 105)
    acc_params ()
    GUISetState(@SW_SHOW)
EndFunc
Func loop_acc_window ()
    While 1
        Switch GUIGetMsg ()
            Case $GUI_EVENT_CLOSE
                GUIDelete()
                init ()
                make_main_window ()
            Case $cadd1
                $count += 1
                $read = InputBox ("Add account", "Please input the account name", "", " M")
                IniWrite ("autologin.ini", "accs", $count, $read)
                GUICtrlSetData ($clist1, $read)
                $read = InputBox ("Add account", "Please input your password", "", "*M")
                $read = _Crypt_EncryptData($read, $key, $CALG_DES)
                IniWrite ("autologin.ini", "pass", $count, $read)
                IniWrite ("autologin.ini", "main", "c", $count)
                init ()
            Case $cadd2
                $counts += 1
                $read = InputBox ("Add server", "Please input the realmlist address", "", " M")
                IniWrite ("autologin.ini", "servers", $counts, $read)
                IniWrite ("autologin.ini", "main", "s", $counts)
                GUICtrlSetData ($clist2, $read)
                init ()
            Case $cremove1
                $read = GUICtrlRead ($clist1)
                If $read = "" Then ContinueLoop
                For $i = 0 To ($count - 1)
                    If $read = $acc[$i] Then
                        ExitLoop
                    EndIf
                Next
                $i += 1
                IniDelete ("autologin.ini", "accs", $i)
                IniDelete ("autologin.ini", "pass", $i)
                $count -= 1
                IniWrite ("autologin.ini", "main", "c", $count)
                GUICtrlSetData($clist1, "")
                If $count <> 0 Then
                    For $i = 1 To $count
                        GUICtrlSetData ($clist1, $acc[$i-1])
                    Next
                EndIf
            Case $cremove2
                $read = GUICtrlRead ($clist2)
                If $read = "" Then ContinueLoop
                For $i = 0 To ($counts - 1)
                    If $read = $serv[$i] Then
                        ExitLoop
                    EndIf
                Next
                $i += 1

                IniDelete ("autologin.ini", "servers", $i)
                $counts -= 1
                IniWrite ("autologin.ini", "main", "s", $counts)
                GUICtrlSetData($clist2, "")
                If $count <> 0 Then
                    For $i = 1 To $counts
                        GUICtrlSetData ($clist2, $serv[$i-1])
                    Next
                EndIf
        EndSwitch
    WEnd
EndFunc
Func acc_params ()
    If $count <> 0 Then
        For $i = 1 To $count
            GUICtrlSetData ($clist1, $acc[$i-1])
        Next
    EndIf
    If $counts <> 0 Then
        For $i = 1 To $counts
            GUICtrlSetData ($clist2, $serv[$i-1])
        Next
    EndIf
EndFunc
Func start ()
    HotKeySet ("{ESC}", "kill")
    HotKeySet ("{PAUSE}", "sent")
    $read = GUICtrlRead ($clist)
    If GUICtrlRead ($ccheck) = $GUI_CHECKED Then Run ($dir & $exe)
    For $i = 0 To ($count - 1)
        If $read = $acc[$i] Then
            ExitLoop
        EndIf
    Next
    $acci = $acc[$i]
    $passi = $pass[$i]
    While 1
        Sleep (100)
        ;ToolTip ("Welcome " & $read & @CRLF & "Press {Pause} to login.")
        ;ToolTip ("Welcome " & $read & "(" & $i & ")" & @CRLF & "Press {Pause} to login.")
        ToolTip ("Welcome " & $acci & @CRLF & "Press {Pause} to login.")
    WEnd
EndFunc
Func manageexe ()
    $file = FileOpenDialog ("Find WoW.exe", $dir, "wow.exe (*.exe)",3,"wow.exe")
    $array = StringSplit ($file, "\")
    $exe = $array[$array[0]]
    $file = StringTrimRight ($file, StringLen ($exe))
    If $dir <> $file Then
        $dir = $file
        IniWrite ("autologin.ini", "main", "path", $dir)
    EndIf
    GUICtrlSetData ($cexe, $exe)
    IniWrite ("autologin.ini", "main", "exe", $exe)
    GUICtrlSetState ($cstart, $GUI_ENABLE)
    GUICtrlSetTip ($cexe, "")
    main_params ()
EndFunc
Func init ()
    If FileExists ("autologin.ini") = 0 Then
        FileOpen ("autologin.ini", 1)
        FileClose (1)
        FileSetAttrib("autologin.ini", "+H")
    EndIf
    $count = IniRead ("autologin.ini", "main", "c", 0)
    If $count > 0 Then
        Global $acc[$count],$cryp[$count],$pass[$count],$bad[$count]
        For $i = 1 To $count
            $acc[$i-1] = IniRead ("autologin.ini", "accs", $i, "")
            $cryp[$i-1] = IniRead ("autologin.ini", "pass", $i, "")
        Next
        For $i = 1 To $count
            $pass[$i-1] = BinaryToString (_Crypt_DecryptData ($cryp[$i-1], $key, $CALG_DES))
            If $pass[$i-1] = "ÿÿÿÿ" Then
                $bad[$i-1] = True
            Else
                $bad[$i-1] = False
            EndIf
        Next
    EndIf
    $counts = IniRead ("autologin.ini", "main", "s", 0)
    If $counts > 0 Then
        Global $serv[$counts]
        For $i = 1 To $counts
            $serv[$i-1] = IniRead ("autologin.ini", "servers", $i, "")
        Next
    EndIf
    $dir = IniRead ("autologin.ini", "main", "path", @ScriptDir)
    $exe = IniRead ("autologin.ini", "main", "exe", "\wow.exe")
    $realm = FileRead ("data\engb\realmlist.wtf")
    If @error Then
        $realm = "Realmlist not found"
    EndIf
EndFunc
Func main_params ()
    If FileExists ($exe) = 0 Then
        GUICtrlSetState ($ccheck, $GUI_UNCHECKED)
        GUICtrlSetState ($ccheck, $GUI_DISABLE)
        GUICtrlSetTip ($cexe, "Exe is missing, please click here to find new one.")
    EndIf
    If $count = 0 Then
        GUICtrlSetState ($cstart, $GUI_DISABLE)
        GUICtrlSetState ($clist, $GUI_DISABLE)
        ToolTip ("There are no accounts, click here to add.", 800, 420, "",1, 1)
    Else
        For $i = 1 To $count
            If $bad[$i-1] = False Then
                $list = $list & "|" & $acc[$i-1]
            Else
                $list = $list & "|" & $acc[$i-1] & "!"
            EndIf
        Next
        GUICtrlSetData($clist, $list);, $acc[0])
    EndIf

    $list = ""
    If $counts = 0 Then
        GUICtrlSetState ($cserv, $GUI_DISABLE)
    Else
        For $i = 1 To $counts
            $list = $list & "|" & $serv[$i-1]
        Next
        GUICtrlSetData($cserv, $list, $serv[0])
    EndIf
EndFunc
Func sent ()
    Send ($acci & "{TAB}" & $passi & "{ENTER}")
    ToolTip ("")
    Exit
EndFunc
Func kill ()
    ToolTip ("")
    Exit
EndFunc

with "$cstart = GUICtrlCreateButton ("Start", 10, 35, 50, 20, 0x0001)" i managed to make it start without using hotkeys, hopefully there is something similar for the other ctrls

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

  • Similar Content

    • dreivilo47
      By dreivilo47
      When I want to test Example 1 of Function _IECreate (AutoIt Help File), I see that function _IECreate doesn't work in Windows 10.
      Syntax Check (Ctrl+F5) gives no errors.
       
      Example 1:
      ; Create a browser window and navigate to a website #include <IE.au3> Local $oIE = _IECreate("www.autoitscript.com")  
      The error I receive with F5 (Tools, Go) in SciTE:

    • Chaym
      By Chaym
      Does AutoIT supported  in Windows 10 OS (x64)?
      After installing AutoIT in x64 OS and recompiling code,
      I get a lot of error messages...
       
    • kristo
      By kristo
      The DriveGetDrive command returned all drives (option "ALL") for years now and my program could always rely on that function. Suddenly a drive letter that was created with the subst command does not appear in the list of drives anymore. And it clearly did, because I used to react to a certain subst command by reacting to new or revoked (subst /D) drive letters.
      Why is that? I think this a bug because there's no way left to list ALL drive letters anymore.
      And why should I use an API command for that when this was already built in for years?

       
    • ModemJunki
      By ModemJunki
      Hello,
      In Windows 10 PowerShell, one can do this to change the metric for a NIC in Windows 10:
      Get-NetAdapter | Where-Object -FilterScript {$_.InterfaceAlias -Eq "Ethernet 2"} | Set-NetIPInterface -InterfaceMetric 2 I know I can script the above PowerShell line (and it works!), but I wanted to try something I hadn't done before after looking into jguinch's most excellent Network configuration UDF. I wanted to make use of the SetIPConnectionMetric method in the WMI classes. There is an example VBscript here but this is not for Windows 10. Using AutoIT would also give better control over capturing error return codes than with PowerShell.
      But I cannot get my script to work! The return from SetIPConnectionMetric() is 0, which would indicate success. Yet the change does not happen. I also tried WMI methods using .put_ but this fails.
      Anyone more experienced than I have ideas to make this work?
      #RequireAdmin _SetNicInterfaceMetric2("Ethernet 2", "2") Func _SetNicInterfaceMetric2($NIC_NAME, $METRIC) Local $s_setIndx = 0 $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2") $colNICItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID = '" & $NIC_NAME & "'", "WQL") If IsObj($colNICItems) Then For $objItem In $colNICItems $s_nicIndex = $objItem.Index Next ConsoleWrite("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Index = '" & $s_nicIndex & "'" & @CRLF) $colNAC = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Index = '" & $s_nicIndex & "'", "WQL") If IsObj($colNAC) Then For $objNetCard In $colNAC If $METRIC <> $objNetCard.IPConnectionMetric Then ConsoleWrite("Metric was set to " & $objNetCard.IPConnectionMetric & ". Setting to " & $METRIC & "." & @CRLF) $s_isSet = $objNetCard.SetIPConnectionMetric($METRIC) ConsoleWrite("SetIPConnectionMetric Result = " & $s_isSet & @CRLF) Else ConsoleWrite("Metric is already set to " & $METRIC & @CRLF) EndIf Next EndIf EndIf EndFunc ;==>_SetNicInterfaceMetric2  
    • mlazovjp
      By mlazovjp
      OK, this one is baffling me and my coworkers.
      I created an AutoIt script with Windows 10 1607 (or maybe 1511) that would do a RunWait "DisplaySwitch.exe /clone" to have both monitors display the same content.  It worked without issue.  Then I upgraded a couple of weeks ago to Windows 10 1703 (Creators Update).  Now when I run the script, it executes everything before and after the RunWait command but the display properties never change.  I used variables to capture the result of the RunWait command and the value of @error.  RunWait returns 0, @error returns 1 (though I don't know what that means exactly).
      I started over with a two-line AutoIt script which attempts to run DisplaySwitch.exe and nothing happens.  I modified the RunWait command to run C:\windows\system32\DisplaySwitch.exe but nothing happens.  So, I created a batch file which just attempts to run C:\windows\system32\DisplaySwitch.exe followed by a pause statement so I could read the results.  It reports "'C:\WINDOWS\System32\DisplaySwitch.exe' is not recognized as an internal or external command, operable program or batch file.".
      So I modified the batch file to perform a directory listing of C:\Windows\system32\*.exe .  It generates a list of 337 files, but if you look through the list, DisplaySwitch.exe is missing.  I then modified the batch file to perform a recursive search for DisplaySwitch.exe from the root of C:\ and it eventually finds this single file: C:\Windows\WinSxS\amd64_microsoft-windows-displayswitch_31bf3856ad364e35_10.0.15063.0_none_fdd58a325d4a2de2\displayswitch.exe
      I can run that file from the batch file and it works fine.  If I run the batch file directly rather than through an AutoIt script, it works fine and it lists DisplaySwitch.exe in C:\Windows\system32 .  
      I have compiled the AutoIt script using v3.3.14.2 and in desperation, I even compiled it with autoit-v3.3.15.0-beta-setup.exe with the same results.  I also tried adding #RequireAdmin with the same results.  If I look at the security properties of the file I cannot find anything which implies that a script could not access it.  I also notice that if I open a command prompt and do the same directory listing of all .exe files in C:\windows\system32 it lists 660 files, compared to only 337 files when that command is run through my AutoIt script.  I can also report that when I made these two files available for download through Google Drive to my colleague running Windows 10 1511, Smart Filter and Symantec both complained about the files, but we bypassed the warning and they executed properly (i.e. DisplaySwitch.exe was visible in C:\windows\system32 and it switched to Clone Mode).  My other colleague with 1703 has the same problem as me where DisplaySwitch.exe is invisible to scripts running from within an AutoIt script.
      switch.au3
      switch.cmd