Jump to content
Sign in to follow this  
JonBMN

[SOLVED]Putting Array values into GUI box (getting all values into the array)

Recommended Posts

JonBMN

I'm trying to take array values which I can't seem to get all the values into the array to send to the GUI window and I can't seem to get the array to even go into the GUI window. Here is the FULL code I'm working with.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Green.ico
#AutoIt3Wrapper_Outfile=DriverInstall.exe
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/so
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
AutoItWinSetTitle("Driver Install")
AutoItSetOption("MustDeclareVars", 1)
Opt("TrayMenuMode", 0)
#NoTrayIcon
#include-once
#RequireAdmin

#include <GUIconstants.au3>
#include <myerror.au3>
#include <misc.au3>
#include <Array.au3>

If _Singleton("Driver Install", 1) = 0 Then
Exit
EndIf

Local $Result
Local $NumComports = -1, $OrigPortNum[30]
Local $NewPortNum[30], $NewNumComports = -1
Local $GUIhandle, $CM[10], $AddedPort, $msg, $newports[20], $oldports[20]

; Update registry to ignor dongle serial number
$Result = RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags", "IgnoreHWSerNum04036001", "REG_BINARY", Chr(1))
If $Result = 0 Then
$ErrorTitle = "Error Updating Registry"
$ErrorMessage = "Unable to update registry UsbFlags"
$IsErrorFatal = True
MyError()
EndIf

MsgBox(0, "Alert!", "Please make sure OBD processor is not plugged into the computer.")

BuildOriginal()
Run("CDM20828.EXE")
MsgBox(0, "Alert!", "Now plug in the OBD processor into the USB port on the computer. When you have plugged it in click OK.")
BuildNew()
GUIwindow()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Quit()
EndSelect
WEnd
Exit

Func Quit()
Exit
EndFunc

Func BuildOriginal()
Local $Instance = 1, $Key = "", $Port = "", $Found = False
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NumComports += 1
$OrigPortNum[$NumComports] = $Port
$Instance += 1
WEnd
for $Instance = 0 To $NumComports
_ArrayPush($OrigPortNum,$OrigPortNum[$Instance], 0)
Next
EndFunc




Func BuildNew()
Local $Instance = 1, $Key = "", $Port = "", $Found = False, $i = 0
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NewNumComports += 1
$NewPortNum[$NewNumComports] = $Port
$Instance += 1
WEnd
for $Instance = 0 To $NewNumComports
_ArrayPush($NewPortNum,$NewPortNum[$Instance], 0)
Next
For $i = 0 To $NewNumComports
If ($NewPortNum[$i] <> $OrigPortNum[$i]) Then
;MsgBox(0, "Alert!", "Found new Port!" & $NewPortNum[$i])
$Addedport = $NewPortNum[$i]
ExitLoop
EndIf
Next
EndFunc

Func GUIwindow()
$GUIhandle = GUICreate("Port Settings", 455, 325)
GUICtrlCreateLabel("-Before OBD doggle plugin-", 15, 25)
$CM[1] = GUICtrlCreateEdit("", 15, 45, 180, 100, 400)
GUICtrlSetData($CM[1], $OrigPortNum, $OrigPortNum)
GUICtrlCreateLabel("-After OBD doggle plugin-", 250, 25)
$CM[2] = GUICtrlCreateEdit("", 250, 45, 180, 100, 400)
GUICtrlSetData($CM[2], $NewPortNum, $NewPortNum)
GUICtrlCreateLabel("This is the added port:", 15, 300)
$CM[3] = GUICtrlCreateEdit("", 120, 300, 150, 20)
GUICtrlSetData($CM[3], $AddedPort, $AddedPort)
GUISetState(@SW_SHOW) ;shows the GUI window
EndFunc
Edited by JonBMN

Share this post


Link to post
Share on other sites
BrewManNH

Well, you can't apply the contents of an array to an edit box directly. You should loop through the array and add each value to a string, and then use the string to update the edit control.


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

Share this post


Link to post
Share on other sites
JonBMN

Any chance you could give me a basic example of this?

Share this post


Link to post
Share on other sites
Melba23

JonBMN,

About as basic as I can make it: ;)

#include <GUIConstantsEx.au3>

; Here is the array
Global $aLines[4] = [3, "Line 1", "Line 2", "Line 3"]

$hGUI = GUICreate("Test", 500, 500)

$cEdit = GUICtrlCreateEdit("", 10, 10, 200, 200)

$cButton = GUICtrlCreateButton("Load Array", 10, 400, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            ; Start with an empty string
            $sData = ""
            ; Loop through the array and add each line to the string - do not forget the line break
            For $i = 1 To $aLines[0]
                $sData &= $aLines[$i] & @CRLF
            Next
            ; And finally, add the string to the edit
            GUICtrlSetData($cEdit, $sData)
    EndSwitch

WEnd

All clear?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
JonBMN

Yes, thank you!

Share this post


Link to post
Share on other sites
BrewManNH

This example is a very basic demo that shows what I was talking about.

You don't really need the _ArrayToString function if you build the string as you build the array, but I used it for simplicity.

#include <GUIconstants.au3>
#include <misc.au3>
#include <Array.au3>

If _Singleton("Driver Install", 1) = 0 Then
    Exit
EndIf

Local $Result
Local $NumComports = -1, $sOrigPortNum
Local $sNewPortNum, $NewNumComports = -1
Local $GUIhandle, $CM[10], $AddedPort, $msg, $newports[20], $oldports[20]

BuildOriginal()
BuildNew()
GUIwindow()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Quit()
    EndSelect
WEnd

Func BuildNew()
    Local $NewPortNum[30]
    For $I = 0 To 29
        $NewPortNum[$I] = $I
    Next
    $sNewPortNum = _ArrayToString($NewPortNum, @CRLF)
EndFunc   ;==>BuildNew

Func BuildOriginal()
    Local $OrigPortNum[30]
    For $I = 0 To 29
        $OrigPortNum[$I] = $I
    Next
    $sOrigPortNum = _ArrayToString($OrigPortNum, @CRLF)
EndFunc   ;==>BuildOriginal

Func GUIwindow()
    $GUIhandle = GUICreate("Port Settings", 455, 325)
    GUICtrlCreateLabel("-Before OBD dongle plugin-", 15, 25)
    $CM[1] = GUICtrlCreateEdit("", 15, 45, 180, 100, 400)
    GUICtrlSetData($CM[1], $sOrigPortNum)
    GUICtrlCreateLabel("-After OBD dongle plugin-", 250, 25)
    $CM[2] = GUICtrlCreateEdit("", 250, 45, 180, 100, 400)
    GUICtrlSetData($CM[2], $sNewPortNum)
    GUICtrlCreateLabel("This is the added port:", 15, 300)
    $CM[3] = GUICtrlCreateEdit("", 120, 300, 150, 20)
    GUICtrlSetData($CM[3], $AddedPort, $AddedPort)
    GUISetState(@SW_SHOW) ;shows the GUI window
EndFunc   ;==>GUIwindow

Func Quit()
    Exit
EndFunc   ;==>Quit


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

Share this post


Link to post
Share on other sites
JonBMN

Thank you both. Both examples will give me a better understanding of what is going on.

Share this post


Link to post
Share on other sites
JonBMN

It seems to be only putting in the last value of the array that's being looped through into the $orig = "" which is my initialized string variable that I want to hold all my array values.

Func BuildOriginal()
Local $Instance = -1, $Key = "", $Port = "", $Found = False
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NumComports += 1
$OrigPortNum[$NumComports] = $Port
$Instance += 1
WEnd
for $Instance = 0 To $NumComports
$orig = $OrigPortNum[$Instance] & @CRLF
Next
EndFunc

so if I had two com ports 13 and 35 the only one it sends to the GUI is 35.

Edited by JonBMN

Share this post


Link to post
Share on other sites
BrewManNH

You're missing the "&" before the "=".

$orig &= $OrigPortNum[$Instance] & @CRLF


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

Share this post


Link to post
Share on other sites
JonBMN

After adding that, I seem to get nothing from the BuildOriginal() function, but the BuildNew() function seems to be working perfectly...

Local $orig = "", $new = ""
Func BuildOriginal()
Local $Instance = -1, $Key = "", $Port = "", $Found = False
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NumComports += 1
$OrigPortNum[$NumComports] = $Port
$Instance += 1
WEnd
for $Instance = 0 To $NumComports
$orig &= $OrigPortNum[$Instance] & @CRLF
Next
EndFunc




Func BuildNew()
Local $Instance = 1, $Key = "", $Port = "", $Found = False, $i = 0
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NewNumComports += 1
$NewPortNum[$NewNumComports] = $Port
$Instance += 1
WEnd
for $Instance = 0 To $NewNumComports
$new &= $NewPortNum[$Instance] & @CRLF
Next
For $i = 0 To $NewNumComports
If ($NewPortNum[$i] <> $OrigPortNum[$i]) Then
;MsgBox(0, "Alert!", "Found new Port!" & $NewPortNum[$i])
$Addedport = $NewPortNum[$i]
ExitLoop
EndIf
Next
EndFunc
Edited by JonBMN

Share this post


Link to post
Share on other sites
BrewManNH

You declared the $Instance variable in BuildNew as -1 instead of 1.


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

Share this post


Link to post
Share on other sites
JonBMN

Ah the little things! thanks for catching that one BrewManNH

Share this post


Link to post
Share on other sites
JonBMN

My program seems to be working perfectly, but when I move it over to a windows XP for testing the $orig and $new values do not show up in the edit control, but I put a msgbox and saw all the com ports from these variables. Any answers to why it may not be showing up?

Edited by JonBMN

Share this post


Link to post
Share on other sites
BrewManNH

No clue, I don't have an XP machine to test it on.


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

Share this post


Link to post
Share on other sites
JonBMN

Local $orig = "", $new = ""
Func BuildOriginal()
Local $Instance = -1, $Key = "", $Port = "", $Found = False
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NumComports += 1
$OrigPortNum[$NumComports] = $Port
$Instance += 1
WEnd
for $Instance = 0 To $NumComports
$orig &= $OrigPortNum[$Instance] & @CRLF
Next
EndFunc




Func BuildNew()
Local $Instance = 1, $Key = "", $Port = "", $Found = False, $i = 0
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NewNumComports += 1
$NewPortNum[$NewNumComports] = $Port
$Instance += 1
WEnd
for $Instance = 0 To $NewNumComports
$new &= $NewPortNum[$Instance] & @CRLF
Next
For $i = 0 To $NewNumComports
If ($NewPortNum[$i] <> $OrigPortNum[$i]) Then
;MsgBox(0, "Alert!", "Found new Port!" & $NewPortNum[$i])
$Addedport = $NewPortNum[$i]
ExitLoop
EndIf
Next
EndFunc

Figured out what was going wrong on the XP machine. It was not the fact that it was an XP it had to many values in the array for the SetData to put into the Edit control. Posting BuildOriginal() function, BuildNew() function along with GUI function.. Not going to post first half as it is posted at top.

Local $orig = "", $new = ""
Func BuildOriginal()
Local $Instance = 1, $Key = "", $Port = "", $Found = False
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NumComports += 1
$OrigPortNum[$NumComports] = $Port
$orig &= $Port & " ** " & $Key & @CRLF
$Instance += 1
WEnd
EndFunc




Func BuildNew()
Local $Instance = 1, $Key = "", $Port = "", $Found = False, $i = 0
While 1
$Key = RegEnumVal("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", $Instance)
If @error = -1 Then
ExitLoop
     EndIf
$Port = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM",$Key )
$NewNumComports += 1
$NewPortNum[$NewNumComports] = $Port
$new &= $Port & " ** " & $Key & @CRLF
$Instance += 1
WEnd
For $i = 0 To $NewNumComports
If ($NewPortNum[$i] <> $OrigPortNum[$i]) Then
$Addedport = $NewPortNum[$i]
ExitLoop
EndIf
Next
EndFunc

Func GUIwindow()
$GUIhandle = GUICreate("Port Settings", 455, 325)
GUICtrlCreateLabel("-Before OBD doggle plugin-", 15, 25)
$CM[1] = GUICtrlCreateEdit("", 15, 45, 180, 200)
GUICtrlSetData($CM[1], $orig, $orig)
GUICtrlCreateLabel("-After OBD doggle plugin-", 250, 25)
$CM[2] = GUICtrlCreateEdit("", 250, 45, 180, 200)
GUICtrlSetData($CM[2], $new, $new)
GUICtrlCreateLabel("This is the added port:", 15, 300)
$CM[3] = GUICtrlCreateEdit("", 120, 300, 150, 20)
GUICtrlSetData($CM[3], $AddedPort, $AddedPort)
GUISetState(@SW_SHOW) ;shows the GUI window
EndFunc

EDIT: cleaned up the code a bit in BuildOriginal() and BuildNew()

Edited by JonBMN

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  

  • Similar Content

    • TrashBoat
      By TrashBoat
      So Im trying to make a simple 2d game and make some sort of collision detection so why not to make a 2 dimensional array but i have no clue how  to write it in multiple lines
      Global $map[5,5] = [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0] something like this but it doesn't work
    • Zein
      By Zein
      #include "..\Include\Array.au3" #include "..\Include\File.au3" #include "..\Include\AutoItConstants.au3" Local $aRetArray Local $sFilePath = "n.csv" _FileReadToArray($sFilePath, $aRetArray, ",") ; _FileReadToArray($sFilePath, $aRetArray, $FRTA_COUNT, ",") _ArrayDisplay($aRetArray, "Original", Default, 8) The above code shows two versions of _FileReadToArray and both don't work as expected.
      The first one doesn't use the comma as a delimiter. (so I get a single column array)  I tried adding "Default" between $aRetArray and "," then it told me it had an incorrect number of parameters. 

      I looked again at the documentation:
       
      #include <File.au3> _FileReadToArray ( $sFilePath, ByRef $vReturn [, $iFlags = $FRTA_COUNT [, $sDelimiter = ""]] )
      And I with or without the flags params I should be getting a 2D array due to my file being a csv. 
      I then tried a regular flag, $FRTA_COUNT, and it tells me that I'm using a variable $FRTA_COUNT while it's not declared. Tried putting in 1 instead and it told me again, incorrect number of params. 

       
    • nacerbaaziz
      By nacerbaaziz
      hi dears, i have an question please if you can help me.
      i maked an program to do some functions
      and this program works with the global hot keys
      i added an option to the users to change the hot keys
      when i searched about how to do that i found this UDF
      GUIHotkey.au3
      http://www.autoitscript.com/forum/index.php?showtopic=107965
      but the problem here that this UDF cant be detect the win key.
      can you help me to add it, or if there are any others UDFSS wich do that work please give me some.
      i hope that my question is clear for you.
      thanks in advance
    • Silas
      By Silas
      Hello everyone,
      I have a radio button ($Radio1), which I want to disable as soon as another one get's checked (Radio5). (The system fails if the radio button i'm troubling with also gets checked).
      I know how to disable him:
      If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_DISABLE) Then GUICtrlSetState($Radio5, 128) But if i try to enable $Radio5 again, after $Radio1 isn't checked anymore, it fails:
      If GUICtrlRead($Radio1)=Not 1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_ENABLE) Then GUICtrlSetState($Radio5, 64)  
      Anyone knows why?
    • ternal
      By ternal
      Hi,
      Recently I have had the need to do a sort and then do a second sort while the item of the first sort stays the same ( double sorting , first on column x then while column x is the same sort column y).
      I did not put much efffort into error checking but so far I did not need it.
      For my applications so far it works perfectly however if someone is willing I want to test this extensivly.
      If anyone has big lists of random stuff to sort could you try this out please?
      #include <Array.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArraySort_Double ; Description ...: ; Syntax ........: _ArraySort_Double (Byref $array[, $first_index = Default[, $second_index = Default[, $ascending = Default]]]) ; Parameters ....: $array - 2d array to sort. ; $first_index - [optional] first column to sort. Default is 0. ; $second_index - [optional] second column to sort. Default is 1. ; $ascending - [optional] ascending/descending. Default is 1. ; Return values .: 1 if no errors occured , -1 if errors occured ; Author ........: Ternal ; Remarks .......: Needs excessive testing. ; Related .......: _arraysort() ; =============================================================================================================================== Func _ArraySort_Double (byref $array, $first_index = Default, $second_index = Default, $ascending = Default) Local $temp_value Local $counter = 1 If UBound($array, $UBOUND_DIMENSIONS) <> 2 Then MsgBox(0, "error", "error") return -1 EndIf If $first_index = Default Then $first_index = 0 If $second_index = Default Then $second_index = 1 If $ascending = Default Then $ascending = 1 _ArraySort($array, $ascending, 0, 0, $first_index); you can alter settings of primary sort here If @error Then MsgBox(0, "error", @error) return -1 EndIf $temp_value = $array[0][$first_index] For $x = 1 to UBound($array, 1) - 1 If Mod( $x, 10000) = 0 Then ConsoleWrite("at " & $x & " of a total : " & UBound($array, 1) & @CRLF) If $array[$x][$first_index] = $temp_value Then $counter+= 1 If $x = UBound($array, 1) - 1 Then; do last line here(if last line is not a new item) _ArraySort($array, $ascending, $x - $counter, $x, $second_index);you can alter settings of secondary sort here(don't forget to place line 34 the exact same) If @error Then MsgBox(0, "error", @error) return -1 EndIf EndIf Else If $counter > 0 Then ;at least 2 of the same _ArraySort($array, $ascending, $x - $counter, $x - 1, $second_index);you can alter settings of secondary sort here(don't forget to place line 29 the exact same) If @error Then MsgBox(0, "error", @error) return -1 EndIf $counter = 1 EndIf EndIf $temp_value = $array[$x][$first_index] Next Return 1 EndFunc Kind regards, Ternal
×