Jump to content

need help to create a treeview linked with array


Recommended Posts

good morning
this is the first post here in the autoit forums
i hope that you can help me in my problem
i have a JSON encoded
it a map of my forums
where i want to make a treeview that have the same type of map
e.g
a system (as category)
windows (as sub category)
software (as an child item in the windows category)
.....
i don't know how to do that
so, i know that i can do that using the json functions
but i need your help about how we can do it as the type that i told you
by the way i need to put the sub info for each item in an array that give me the ability to manage my items
e.g
can post thread
can reply
message cound ...
you just give me a small example and i can continue.
am sorry if this against the rules of the forum.
but i realy searched a lot but i couldn't
i hope some one give me the way.
thank you very much in advance

 

here is the link of json forum
https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn/

and here is my encoded json file

 

{
    "tree_map": {
        "0": [
            1,
            5,
            6,
            7
        ],
        "1": [
            2
        ],
        "2": [
            4
        ],
        "5": [
            3
        ],
        "6": [
            8
        ],
        "8": [
            9,
            10
        ]
    },
    "nodes": [
        {
            "breadcrumbs": [],
            "description": "",
            "display_in_list": true,
            "display_order": 1,
            "node_id": 1,
            "node_name": null,
            "node_type_id": "Category",
            "parent_node_id": 0,
            "title": "Main category",
            "type_data": {}
        },
        {
            "breadcrumbs": [
                {
                    "node_id": 1,
                    "title": "Main category",
                    "node_type_id": "Category"
                }
            ],
            "description": "",
            "display_in_list": true,
            "display_order": 1,
            "node_id": 2,
            "node_name": null,
            "node_type_id": "Forum",
            "parent_node_id": 1,
            "title": "Main forum",
            "type_data": {
                "allow_poll": true,
                "allow_posting": true,
                "can_create_thread": true,
                "can_upload_attachment": true,
                "discussion_count": 0,
                "last_post_date": 0,
                "last_post_id": 0,
                "last_post_username": "",
                "last_thread_id": 0,
                "last_thread_prefix_id": 0,
                "last_thread_title": "",
                "message_count": 0,
                "min_tags": 0,
                "require_prefix": false
            }
        },
        {
            "breadcrumbs": [
                {
                    "node_id": 1,
                    "title": "Main category",
                    "node_type_id": "Category"
                },
                {
                    "node_id": 2,
                    "title": "Main forum",
                    "node_type_id": "Forum"
                }
            ],
            "description": "",
            "display_in_list": true,
            "display_order": 1,
            "node_id": 4,
            "node_name": null,
            "node_type_id": "Forum",
            "parent_node_id": 2,
            "title": "my forums1",
            "type_data": {
                "allow_poll": true,
                "allow_posting": true,
                "can_create_thread": true,
                "can_upload_attachment": true,
                "discussion_count": 0,
                "last_post_date": 0,
                "last_post_id": 0,
                "last_post_username": "",
                "last_thread_id": 0,
                "last_thread_prefix_id": 0,
                "last_thread_title": "",
                "message_count": 0,
                "min_tags": 0,
                "require_prefix": false
            }
        },
        {
            "breadcrumbs": [],
            "description": "",
            "display_in_list": true,
            "display_order": 2,
            "node_id": 5,
            "node_name": null,
            "node_type_id": "Category",
            "parent_node_id": 0,
            "title": "Perfect",
            "type_data": {}
        },
        {
            "breadcrumbs": [
                {
                    "node_id": 5,
                    "title": "Perfect",
                    "node_type_id": "Category"
                }
            ],
            "description": "",
            "display_in_list": true,
            "display_order": 2,
            "node_id": 3,
            "node_name": null,
            "node_type_id": "Forum",
            "parent_node_id": 5,
            "title": "ahmed",
            "type_data": {
                "allow_poll": true,
                "allow_posting": true,
                "can_create_thread": true,
                "can_upload_attachment": true,
                "discussion_count": 0,
                "last_post_date": 0,
                "last_post_id": 0,
                "last_post_username": "",
                "last_thread_id": 0,
                "last_thread_prefix_id": 0,
                "last_thread_title": "",
                "message_count": 0,
                "min_tags": 0,
                "require_prefix": false
            }
        },
        {
            "breadcrumbs": [],
            "description": "",
            "display_in_list": true,
            "display_order": 3,
            "node_id": 6,
            "node_name": null,
            "node_type_id": "Forum",
            "parent_node_id": 0,
            "title": "autoit",
            "type_data": {
                "allow_poll": true,
                "allow_posting": true,
                "can_create_thread": true,
                "can_upload_attachment": true,
                "discussion_count": 0,
                "last_post_date": 0,
                "last_post_id": 0,
                "last_post_username": "",
                "last_thread_id": 0,
                "last_thread_prefix_id": 0,
                "last_thread_title": "",
                "message_count": 0,
                "min_tags": 0,
                "require_prefix": false
            }
        },
        {
            "breadcrumbs": [
                {
                    "node_id": 6,
                    "title": "autoit",
                    "node_type_id": "Forum"
                }
            ],
            "description": "",
            "display_in_list": true,
            "display_order": 3,
            "node_id": 8,
            "node_name": null,
            "node_type_id": "Forum",
            "parent_node_id": 6,
            "title": "examples",
            "type_data": {
                "allow_poll": true,
                "allow_posting": true,
                "can_create_thread": true,
                "can_upload_attachment": true,
                "discussion_count": 0,
                "last_post_date": 0,
                "last_post_id": 0,
                "last_post_username": "",
                "last_thread_id": 0,
                "last_thread_prefix_id": 0,
                "last_thread_title": "",
                "message_count": 0,
                "min_tags": 0,
                "require_prefix": false
            }
        },
        {
            "breadcrumbs": [
                {
                    "node_id": 6,
                    "title": "autoit",
                    "node_type_id": "Forum"
                },
                {
                    "node_id": 8,
                    "title": "examples",
                    "node_type_id": "Forum"
                }
            ],
            "description": "",
            "display_in_list": true,
            "display_order": 3,
            "node_id": 9,
            "node_name": null,
            "node_type_id": "Forum",
            "parent_node_id": 8,
            "title": "GUI",
            "type_data": {
                "allow_poll": true,
                "allow_posting": true,
                "can_create_thread": true,
                "can_upload_attachment": true,
                "discussion_count": 0,
                "last_post_date": 0,
                "last_post_id": 0,
                "last_post_username": "",
                "last_thread_id": 0,
                "last_thread_prefix_id": 0,
                "last_thread_title": "",
                "message_count": 0,
                "min_tags": 0,
                "require_prefix": false
            }
        },
        {
            "breadcrumbs": [
                {
                    "node_id": 6,
                    "title": "autoit",
                    "node_type_id": "Forum"
                },
                {
                    "node_id": 8,
                    "title": "examples",
                    "node_type_id": "Forum"
                }
            ],
            "description": "",
            "display_in_list": true,
            "display_order": 31,
            "node_id": 10,
            "node_name": null,
            "node_type_id": "Forum",
            "parent_node_id": 8,
            "title": "windowEX",
            "type_data": {
                "allow_poll": true,
                "allow_posting": true,
                "can_create_thread": true,
                "can_upload_attachment": true,
                "discussion_count": 0,
                "last_post_date": 0,
                "last_post_id": 0,
                "last_post_username": "",
                "last_thread_id": 0,
                "last_thread_prefix_id": 0,
                "last_thread_title": "",
                "message_count": 0,
                "min_tags": 0,
                "require_prefix": false
            }
        },
        {
            "breadcrumbs": [],
            "description": "",
            "display_in_list": true,
            "display_order": 4,
            "node_id": 7,
            "node_name": null,
            "node_type_id": "Category",
            "parent_node_id": 0,
            "title": "vbs",
            "type_data": {}
        }
    ]
}

 

Link to post
Share on other sites

So far nobody helped so either your question is not clear or you have not shown effort what you tried.

Your question seems to be create a treeview in a json similar layout and details should be shown out of an array.

If thats the question just 

Take example in help file or search forum for treeview.

Show what you tried and you will get more help and suggestions.

Link to post
Share on other sites
22 hours ago, junkew said:

Show what you tried and you will get more help and suggestions.

;;; i will try explaying to you what i need in this example
#include <GUIConstants.au3>
Dim $arrayInfos[9][5]
$h_myTreeGUI = GUICreate("treeview", 240, 200)
$h_myTreeCTRL = GUICtrlCreateTreeView(20, 10, 200, 90)
$h_Item1 = GUICtrlCreateTreeViewItem("Windows forums", $h_myTreeCTRL)
$h_Item2 = GUICtrlCreateTreeViewItem("android forums", $h_myTreeCTRL)
$h_Item3 = GUICtrlCreateTreeViewItem("autoit development forums", $h_myTreeCTRL)
$h_SubItem1 = GUICtrlCreateTreeViewItem("softwares", $h_Item1)
$h_SubItem2 = GUICtrlCreateTreeViewItem("corses", $h_Item1)
$h_SubItem1Child1 = GUICtrlCreateTreeViewItem("download and upload", $h_SubItem1)
$h_SubItem1Child2 = GUICtrlCreateTreeViewItem("files recovry", $h_SubItem1)
$h_SubItem1Child3 = GUICtrlCreateTreeViewItem("internet download manager", $h_SubItem1Child1)
$h_SubItem1Child4 = GUICtrlCreateTreeViewItem("free download manager", $h_SubItem1Child1)
$h_SubItem1Child5 = GUICtrlCreateTreeViewItem("Recova", $h_SubItem1Child2)
$h_SubItem2 = GUICtrlCreateTreeViewItem("free apk", $h_Item2)
$h_SubItem3 = GUICtrlCreateTreeViewItem("autoit questions", $h_Item3)
$h_SubItem3Chiled1 = GUICtrlCreateTreeViewItem("GUI questions", $h_SubItem3)
$h_SubItem3Chiled2 = GUICtrlCreateTreeViewItem("consol Questions", $h_SubItem3)
#cs
 now what i need is to stoc this in array or any thing that allow me to get the data
because i have some sub infos
such as any forum must have data
e.g
number of threads
last post
type
etc...
this is just example
because the forums that i have is in json encoded
for that i can not use an variable in evry item
because i not know how much of variables that i have
i hope that you get what i need to
#ce

GUISetState()
While 1
    Switch GUIGetMsg()
        Case $GUI_event_close
            Exit
    EndSwitch
WEnd

 

Edited by Jos
No need to quote whole posts when not required :)
Link to post
Share on other sites

Hi,

Here is an example of how you can do it:

 

#include <GUIConstants.au3>
#include <GuiTreeView.au3>


$h_myTreeGUI = GUICreate("treeview", 540, 500)
Global $h_myTreeCTRL = GUICtrlCreateTreeView(20, 10, 500, 290)
$Input1 = GUICtrlCreateInput("", 24, 311, 491, 21)
$Input2 = GUICtrlCreateInput("", 24, 337, 491, 21)
$Input3 = GUICtrlCreateInput("", 24, 364, 491, 21)
$Input4 = GUICtrlCreateInput("", 24, 394, 491, 21)
$Input5 = GUICtrlCreateInput("", 24, 421, 491, 21)
$Input6 = GUICtrlCreateInput("", 26, 450, 491, 21)

Global $a_Cat[100][2]
Global $a_Sub[200][3]
Global $a_Dat[200][7]

$a_Cat[0][0] = 0
$a_Sub[0][0] = 0
$a_Dat[0][0] = 0

AddLV_folder("", "Windows forums", 0)
AddLV_folder("", "android forums", 0)
AddLV_folder("", "autoit development forums", 0)


AddLV_folder("Windows forums", "softwares", 4)
AddLV_folder(4, "download and upload", 5)
AddLV_folder(4, "files recovry", 6)
AddLV_folder("Windows forums", "corses", 7)

AddLV_folder("android forums", "free apk", 8)

AddLV_folder("autoit development forums", "autoit questions", 9)
AddLV_folder(9, "GUI questions", 10)
AddLV_folder(9, "consol Questions", 11)


AddLV_Info(5,"internet download manager","internet_download manager.exe","c:\Progs\IDM\","www.test.com","Downloadmanager by Asd Fghi")
AddLV_Info(5,"free download manager","free download manager.exe","c:\Progs\FDM\","https://www.freedownloadmanager.org/","Best download manager")
AddLV_Info(6,"Recuva","Recuva.exe","c:\Progs\Recuva\","https://www.ccleaner.com/recuva","Recover deleted files")
AddLV_Info(222,"Test","test.exe","c:\test\","https://www.test.com/","Test entry for the top level data info")

Func AddLV_folder($cat_or_id, $name, $idnr)
    ;Call this function to add folder type items
    ;
    ;If $cat_or_id is empty, it will automatically create a top/root level item
    ;If $cat_or_id has a name, then the new item will be added too previously created root level item
    ;If $cat_or_id is a number, then the new item will be added to a previously created subitem
    ;
    ;$idnr - make sure that this is an unique number, it will be used to add to the subfolders
    ;$idnr is not used for the root items, use names for them instead
    ;
    ;$name = display name on the treeview

    Local $x, $found = -1, $foundId = 0, $tmp = 0, $t

    If IsNumber($cat_or_id) Then
        CW("number = " & $cat_or_id)
        For $x = 1 To $a_Sub[0][0]                        ;Search for the subcategory number
            If $cat_or_id = $a_Sub[$x][2] Then
                $found = $x
                $foundId = $a_Sub[$x][1]
                ExitLoop
            EndIf
        Next
    Else                                                 ;Search for the category name

        For $x = 1 To $a_Cat[0][0]
            If $cat_or_id = $a_Cat[$x][0] Then
                $found = $x
                $foundId = $a_Cat[$x][1]
                ExitLoop
            EndIf
        Next
    EndIf

    If $found > 0 Then
        $a_Sub[0][0] = $a_Sub[0][0] + 1        ;Place the Count of the categories into $a_Cat[0][0]
        Local $t = $a_Sub[0][0]
        $a_Sub[$t][0] = $name
        $a_Sub[$t][1] = GUICtrlCreateTreeViewItem($name, $foundId)
        $a_Sub[$t][2] = $idnr
        $t=$a_Sub[$t][1]
    Else
        $a_Cat[0][0] = $a_Cat[0][0] + 1       ;Place the Count of the categories into $a_Cat[0][0]
        Local $t = $a_Cat[0][0]
        $a_Cat[$t][0] = $name
        $a_Cat[$t][1] = GUICtrlCreateTreeViewItem($name, $h_myTreeCTRL)
        $t=$a_Cat[$t][1]
    EndIf

    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    _GUICtrlTreeView_SetIcon($h_myTreeCTRL, $t, "shell32.dll", 4)
EndFunc   ;==>AddLV_folder

Func AddLV_Info($idnr, $name, $i1, $i2 = "", $i3 = "", $i4 = "")
    ;$IdNr - to which subcategory should the info be added
    ;if subcategory is not found, the new item will be created at the root level

    Local $tmp, $found = -1, $foundId
    For $x = 1 To $a_Sub[0][0]
        If $idnr = $a_Sub[$x][2] Then
            $foundId = $a_Sub[$x][1]
            $found = 1
            ExitLoop
        EndIf
    Next
    If $found < 0 Then
        $foundId = $h_myTreeCTRL
    EndIf

    $a_Dat[0][0] = $a_Dat[0][0] + 1
    $tmp = $a_Dat[0][0]
    $a_Dat[$tmp][1] = $name
    $a_Dat[$tmp][2] = GUICtrlCreateTreeViewItem($name, $foundId)
    $a_Dat[$tmp][3] = $i1
    $a_Dat[$tmp][4] = $i2
    $a_Dat[$tmp][5] = $i3
    $a_Dat[$tmp][6] = $i4
    _GUICtrlTreeView_SetIcon($h_myTreeCTRL, $a_Dat[$tmp][2], "shell32.dll", 1)
EndFunc   ;==>AddLV_Info

GUISetState()

While 1
    $gmsg=GUIGetMsg()
    Switch $gmsg
        Case $GUI_event_close
            Exit
        Case Else
            for $x=1 to $a_Dat[0][0]
                If $gmsg=$a_Dat[$x][2] Then
                    GUICtrlSetData ($Input1,$a_Dat[$x][1])                          ;this line is used internaly (LV item name)
                    GUICtrlSetData ($Input2,$a_Dat[$x][2])                          ;this line is used internaly (LV item id)
                    GUICtrlSetData ($Input3,$a_Dat[$x][3])  ;The actual info starts here
                    GUICtrlSetData ($Input4,$a_Dat[$x][4])
                    GUICtrlSetData ($Input5,$a_Dat[$x][5])
                    GUICtrlSetData ($Input6,$a_Dat[$x][6])
                EndIf
            Next
    EndSwitch
WEnd

Func CW($txt)
    ConsoleWrite($txt & @CRLF)
EndFunc   ;==>CW

 

P.S. there are no array limit checks, add them if needed.

Edited by Dan_555
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Mo0C0w
      Hey guys!
      I just started working with the GUI yesterday and it has only brought more fun to the Autoit adventure  
      Basically I have a GUI windows that opens and based on the selection of the combo box the button will do something different. This specific scenario I am talking about the Client Update Verification  combo selection. When selected and the button is pressed my second gui window opens. As of now if I only paste comp1 or comp2 by itself it works correctly, but if I paste both, it has a fit.
      What would the correct way to do this be? Any help or examples, would be greatly appreciated! Thank you in advance
       
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Client_List.au3> #Region ### START Koda GUI section ### Form=c:\users\dnoble\pictures\plexiibox v4.kxf Global $Form1_1 = GUICreate("Plexii", 336, 419, 1548, 586) GUISetBkColor(0xFFFFFF) Global $Pic1 = GUICtrlCreatePic("C:\Users\dnoble\Pictures\plexii.jpg", 41, 0, 252, 268, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE)) Global $Label2 = GUICtrlCreateLabel("Select Test", 125, 280, 95, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $Combo2 = GUICtrlCreateCombo("Select Test", 39, 312, 257, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Client Update Verification|Bids") GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Proceed", 111, 352, 129, 33) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Combo2) = "Client Update Verification" Then _Form2() ;clientupdateverification() EndSwitch WEnd Func _Form2() #Region ### START Koda GUI section ### Form=c:\users\dnoble\pictures\plexiiboxclientupdate verification.kxf $Form1_1 = GUICreate("Plexii", 336, 521, 866, 454) GUISetBkColor(0xFFFFFF) $Edit1 = GUICtrlCreateEdit("", 57, 72, 241, 345) GUICtrlSetData(-1, "Edit1") $Button1 = GUICtrlCreateButton("Execute", 95, 440, 145, 41) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Edit1) = "comp1" Then comp1() If GUICtrlRead($Edit1) = "comp2" Then comp2() EndSwitch WEnd EndFunc  

    • By XGamerGuide
      I'm trying to assign a faint text in the background to an input field that disappears after the input has started. This should have a certain color such as gray.
    • By Bruceway
      Hi All, 
      I am trying to mark out the middle square of this Magnify Routine "window on right" (stolen from M23 - Thanks) - I assume the DllCall is overwriting the boxes. But wherever I try and redraw, they won't stay on the Magnify Window. Can anyone advise, bet way to keep boxes around the middle square.
      Please be kind with my code, it is ripped from a MUCH bigger exe.
      The "half" transparent window, is for dragging to where you want it, and the buttons are for more precise placement.
      #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> Global $hMag_GUI, $hMagDC, $hDeskDC, $hPen, $oObj, $aWinPos[2], $iLast_Mouse_X = 0, $iLast_Mouse_Y = 0 Global $pWindowCaptureX, $pWindowCaptureY Global $pWindowMagWinX, $pWindowMagWinY #Region - GUI3 ; *** Grabber/Picker Window Global $hGUI3 = GUICreate("Capture", 150, 150, $pWindowCaptureX, $pWindowCaptureY, $WS_EX_TOOLWINDOW) Global $Pic1 = GUICtrlCreatePic("", 70, 40, 10, 10, BitOR($GUI_SS_DEFAULT_PIC,$WS_BORDER)) Global $hButtonUp = GUICtrlCreateButton("U", 65, 60, 20, 20) Global $hButtonDown = GUICtrlCreateButton("D", 65, 100, 20, 20) Global $hButtonLeft = GUICtrlCreateButton("L", 40, 80, 20, 20) Global $hButtonRight = GUICtrlCreateButton("R", 90, 80, 20, 20) Global $hButtonOK = GUICtrlCreateButton("OK", 60, 80, 30, 20) #EndRegion - GUI3 #Region - GUI4 Global $hGUI4 = GUICreate("MagWin", 250, 250, 325, 195) Global $hButtonMOK = GUICtrlCreateButton("OK", 45, 140, 30, 20) Global $hButtonMUp = GUICtrlCreateButton("U", 50, 120, 20, 20) Global $hButtonMDown = GUICtrlCreateButton("D", 50, 160, 20, 20) Global $hButtonMLeft = GUICtrlCreateButton("L", 25, 140, 20, 20) Global $hButtonMRight = GUICtrlCreateButton("R", 75, 140, 20, 20) Global $hLabelWindow = GUICtrlCreateLabel("Window", 5, 185, 44, 15) Global $hLabelWindowText = GUICtrlCreateLabel("", 60, 185, 176, 15) Global $hLabelCheck = GUICtrlCreateLabel("Check", 5, 205, 44, 15) Global $hLabelCheckText = GUICtrlCreateLabel("", 60, 205, 176, 15) Global $hLabelScreen = GUICtrlCreateLabel("Screen", 5, 225, 44, 15) Global $hLabelScreenText = GUICtrlCreateLabel("", 60, 225, 176, 15) #EndRegion - GUI4 ;GUISetState(@SW_HIDE, $hGUI1) GUISetState(@SW_SHOW, $hGUI3) GUISetState(@SW_SHOW, $hGUI4) WinSetTrans($hGUI3, "", 100) $hMag_GUI = WinGetHandle("MagWin") ; Get device context for Mag GUI $hMagDC = _WinAPI_GetDC($hMag_GUI) If @error Then Exit ; Get device context for desktop $hDeskDC = _WinAPI_GetDC(0) If @error Then _WinAPI_ReleaseDC($hMag_GUI, $hMagDC) Exit EndIf ; Create pen $hPen = _WinAPI_CreatePen($PS_SOLID, 5, 0x7E7E7E) $oObj = _WinAPI_SelectObject($hMagDC, $hPen) ; Loop until the user exits. ; *** Static Window While 1 ; Reset position Local $aWinPos = WinGetPos("Capture") If $aWinPos[0] <> $iLast_Mouse_X Or $aWinPos[1] <> $iLast_Mouse_Y Then ; Redraw Mag GUI _FOEA_Loupe($aWinPos) ;~ Local $TWPx = $aWinPos[0]+81 ;+81 Top Left Corner; +85 Middle ;~ Local $TWPy = $aWinPos[1]+75 ;+75 Top Left Corner; +80 Middle ;~ ;*** WINDOW COORDS = x+81 & y+75 (top left of picker square) GUISetState(@SW_HIDE, $hGUI3) Local $output1 = PixelCheckSum($aWinPos[0]+81, $aWinPos[1]+75, $aWinPos[0]+91, $aWinPos[1]+85) Local $output2 = PixelCheckSum($aWinPos[0]+73, $aWinPos[1]+66, $aWinPos[0]+83, $aWinPos[1]+76) If $aWinPos[0] < 1440 Then GUICtrlSetData($hLabelWindowText, $aWinPos[0]+81 & "(" & $aWinPos[0]+81+1440 &")," & $aWinPos[1]+75 & " : " & $output1) GUICtrlSetData($hLabelCheckText, $aWinPos[0]+73 & "(" & $aWinPos[0]+73+1440 & ")," & $aWinPos[1]+66 & " : " & $output2) GUICtrlSetData($hLabelScreenText, "W: " & $aWinPos[0]+73 & "(" & $aWinPos[0]+73+1440 &")," & $aWinPos[1]+66 & " C: " & $aWinPos[0]+81 & "," & $aWinPos[1]+75) Else GUICtrlSetData($hLabelWindowText, $aWinPos[0]+81-1440 & "(" & $aWinPos[0]+81 &")," & $aWinPos[1]+75 & " : " & $output1) GUICtrlSetData($hLabelCheckText, $aWinPos[0]+89-1440 & "(" & $aWinPos[0]+89 &")," & $aWinPos[1]+84 & " : " & $output2) GUICtrlSetData($hLabelScreenText, "W: " & $aWinPos[0]+73-1440 & "(" & $aWinPos[0]+73 & ")," & $aWinPos[1]+66 & " C: " & $aWinPos[0]+81 & "," & $aWinPos[1]+75) ;GUICtrlSetData($hLabel2, $aWinPos[1]+75) EndIf GUISetState(@SW_SHOW, $hGUI3) $iLast_Mouse_X = $aWinPos[0] $iLast_Mouse_Y = $aWinPos[1] $pWindowCaptureX = $aWinPos[0] $pWindowCaptureY = $aWinPos[1] ; *** Box ; Tried it here - doesn't work ;~ Global $Graphic = GUICtrlCreateGraphic(176, 55, 2, 20) ;~ Global $Graphic = GUICtrlCreateGraphic(194, 55, 2, 20) ;~ Global $Graphic = GUICtrlCreateGraphic(176, 55, 20, 2) ;~ Global $Graphic = GUICtrlCreateGraphic(176, 73, 20, 2) ;~ Global $Graphic = GUICtrlCreateGraphic(0, 0, 1, 1) EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Local $aWinPos = WinGetPos("MagWin") $pWindowMagWinX = $aWinPos[0] $pWindowMagWinY = $aWinPos[1] ;GUISetState(@SW_HIDE, $hGUI3) GUIDelete($hGUI3) ; Clear up Mag GUI _WinAPI_SelectObject($hMagDC, $oObj) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDeskDC) _WinAPI_ReleaseDC($hMag_GUI, $hMagDC) ;GUISetState(@SW_HIDE, $hMag_G GUIDelete($hGUI4) GUIDelete($hMag_GUI) ExitLoop Case $hButtonMOK GUISetState(@SW_HIDE, $hGUI3) Local $aWinPos = WinGetPos("Capture") Local $TWPx = $aWinPos[0]+81 ;+81 Top Left Corner; +85 Middle Local $TWPy = $aWinPos[1]+75 ;+75 Top Left Corner; +80 Middle ;*** WINDOW COORDS = x+81 & y+75 (top left of picker square) If $aWinPos[0] > 1440 Then $aWinPos[0] = $aWinPos[0]-1440 $TWPx = $TWPx-1440 EndIf Local $output0 = PixelCheckSum($TWPx-8, $TWPy-9, $TWPx-8+10, $TWPy+1) ;_FOEA_WinAPI_DrawRect(LRChecksum($TWPx-8), $TWPy-9, LRChecksum($TWPx-8)+10, $TWPy+1, 0xFFFFFF, 50) MsgBox($MB_SYSTEMMODAL, "Results ", _ "Window Coords" & @CRLF & _ $TWPx & "(" & $TWPx+1440 & "), " & $TWPy & @CRLF & _ "Checksum0: " & $output0 & @CRLF) GUISetState(@SW_SHOW, $hGUI3) WinActivate($hGUI3, "Capture") Case $hButtonMUp _FOEA_ButtonMUp() Case $hButtonMDown _FOEA_ButtonMDown() Case $hButtonMRight _FOEA_ButtonMRight() Case $hButtonMLeft _FOEA_ButtonMLeft() EndSwitch WEnd Func _FOEA_Loupe($aWinPos) Local $iX, $iY DllCall("gdi32.dll", "int", "StretchBlt", _ "int", $hMagDC, "int", 10, "int", 10, "int", 110, "int", 110, _ "int", $hDeskDC, "int", $aWinPos[0]+68, "int", $aWinPos[1]+61, "int", 20, "int", 20, _ "long", $SRCCOPY) DllCall("gdi32.dll", "int", "StretchBlt", _ "int", $hMagDC, "int", 130, "int", 10, "int", 110, "int", 110, _ "int", $hDeskDC, "int", $aWinPos[0]+70, "int", $aWinPos[1]+63, "int", 7, "int", 7, _ "long", $SRCCOPY) ; Appears initially - then disappears... Global $Graph1 = GUICtrlCreateGraphic(170, 57, 8, 16, $SS_WHITERECT) Global $Graph2 = GUICtrlCreateGraphic(170, 73, 31, 8, $SS_WHITERECT) Global $Graph3 = GUICtrlCreateGraphic(193, 57, 8, 16, $SS_WHITERECT) Global $Graph4 = GUICtrlCreateGraphic(170, 49, 31, 8, $SS_WHITERECT) ; This apears to be needed to stop the Magnify window moving Global $Graph5 = GUICtrlCreateGraphic(0, 0, 1, 1) ;Tried this too - no difference GUISetState(@SW_SHOW, $Graph1) GUISetState(@SW_SHOW, $Graph2) GUISetState(@SW_SHOW, $Graph3) GUISetState(@SW_SHOW, $Graph4) EndFunc ;==>Loupe Func _FOEA_ButtonMUp() Local $aWinPos = WinGetPos("Capture") WinMove($hGUI3, "Capture", $aWinPos[0], $aWinPos[1]-1) EndFunc Func _FOEA_ButtonMDown() Local $aWinPos = WinGetPos("Capture") WinMove($hGUI3, "Capture", $aWinPos[0], $aWinPos[1]+1) EndFunc Func _FOEA_ButtonMRight() Local $aWinPos = WinGetPos("Capture") WinMove($hGUI3, "Capture", $aWinPos[0]+1, $aWinPos[1]) EndFunc Func _FOEA_ButtonMLeft() Local $aWinPos = WinGetPos("Capture") WinMove($hGUI3, "Capture", $aWinPos[0]-1, $aWinPos[1]) EndFunc  
    • By XGamerGuide
      I'm trying to display a GIF. However, the GUI should not be visible. Here is an attempt that doesn't work:
      $sGIF = "MyGIF.gif" #Include <IE.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WINAPI.au3> #include <SendMessage.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet("{ESC}", "_Exit") $hGui = GUICreate("Test", 400, 300, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 10, 10, 380, 280) _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 250) _IENavigate($oIE, $sGIF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch WEnd Func _Exit() Exit  
    • By vinnyMS
      #Include <Array.au3> #include <Constants.au3> $s = FileRead("2.txt") Local $w = StringRegExp($s, '(?is)(\b\w+\b)(?!.*\b\1\b)', 3) _ArrayColInsert($w, 1) For $i = 0 to UBound($w)-1 StringRegExpReplace($s, '(?i)\b' & $w[$i][0] & '\b', $w[$i][0]) $w[$i][1] = @extended Next _ArraySort($w, 1, 0, 0, 1) _ArrayDisplay($w) i have this script that returns 3 columns  
       
      i need to copy the  Col 0 and Col 1 as text to paste on notepad or excel
      you will have to create a "copy" button if possible
      array.au3 2.txt
×
×
  • Create New...