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

    • MrCheese
      By MrCheese
      hi all,
      reviewing the forum, this thread is applicable: 
       
       
      I wanted to know if there is now a better way to do this?
      In essence, I load a tab delimited txt file into an array (works well). I used tab, as some fields in the original csv contains commas.
      However, I needed autoit to manipulate this array, and output it as a csv.
      IF my array contains items with a comma, without double quotes around the field, then how best do I get a csv out of this?
      My current workaround is to filewritefromarray tab delimited, then open it in excel and save as a csv. I will need to check this to see how the address fields behave that contain a comma.
       
      Any thoughts would be appreciated.
       
    • Skeletor
      By Skeletor
      Hi All,

      I would like to know how you would take a FileLineRead and insert it into an array which then inserts it into Excel?
      One thing to know is the files content is broken up, so I only use half of the content within $FileRead1.
      So its imperative that the $value1, $value2, etc variables be used. 
      Code below:
      $FileRead1 = FileReadLine("C:\temp\sample.txt",1) For $count = 1 To _FileCountLines($FileRead1) Step 1 $string = FileReadLine($FileRead1, $count) $input = StringSplit($string, ",", 1) $value1 = $input[1] $value2 = $input[2] $value3 = $input[3] $value4 = $input[4] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value1, "A1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value2, "B1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value3, "C1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value4, "D1") Next  
    • AnonymousX
      By AnonymousX
      Hello,
      I'm trying to write a script that moves copies excel cells into an array. I'll than manipulate the values and send array into another program. 
      I don't want range to be specific to a workbook, or sheet, or set of cells.
      I want user to be able to highlight desired cells and to copy either normally ("Ctrl+C") or by a hotkey ("Alt+C"). 
      Could someone help me with this?
      Thank you,
      I've tried to write the framework: (edited)
      #include <MsgBoxConstants.au3> #include <Array.au3> #include <Excel.au3> HotKeySet("!v", "Pastedata") While True Sleep(1000) WEnd func Makearray() local $bArray ;User has cells already copied ;Convert clipboard into an array ;I don;t know how excel stores data to clipboard so don;t know how to bring it into array _Arraydisplay($bArray) MsgBox(0,0,$bArray) return $bArray endfunc func Pastedata() Local $aArray MsgBox(0,0,"wait",1) ;make array based on assumption user has already copied a range to clipboard $aArray = Makearray() ;paste code ;don;t worry about this I got the rest endfunc  
    • Blois
      By Blois
      Hi Guis,
       
      I need to create keyboard shortcut to navigate the tabs and activate them, but I could not use the code below:
      #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiTab.au3> #include <GUIConstantsEx.au3> HotKeySet("^{TAB}", "_TabRight") HotKeySet("^+{TAB}", "_TabLeft") $gui = GUICreate("test",450, 300) $Tab1 = GUICtrlCreateTab(20, 24, 425, 201) $TabSheet1 = GUICtrlCreateTabItem("Tabsheet 1") $lbContagemGrupos2 = GUICtrlCreateLabel("aaaa", 50, 50) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateTabItem("") $TabSheet2 = GUICtrlCreateTabItem(" ") $TabSheet3 = GUICtrlCreateTabItem(" ") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _TabRight() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos + 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Func _TabLeft() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos - 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Exit  
      can you help me?
    • Pricehacker
      By Pricehacker
      Hello again!
      I have tried searching for quite some time now but couldn´t find a single working way to change the class of your GUI that doesn´t include changing it manually after its compilation.
      First or "AutoIt v3 GUI" is a pretty boring name tbh and i would like to spice it up a bit, also, and more importantly, I would like to identify my windows by something other than its title as it will change depending on some factors and im using two different programs independently as multi threading isn't supported.
      Any help is appreciated! Thank you!
×