Sign in to follow this  
Followers 0
AuToItItAlIaNlOv3R

ListView Help

29 posts in this topic

Hello forum, i would like to integrate to my download manager a linkchecker. I've write this code

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <INet.au3>
$Form1 = GUICreate("Add Link Here", 394, 247, 156, 156)
$Link = GUICtrlCreateEdit("", 0, 0, 393, 201)
$Clear = GUICtrlCreateButton("Clear", 120, 208, 75, 33, $WS_GROUP)
$Check = GUICtrlCreateButton("Check Now!", 216, 208, 75, 33, $WS_GROUP)
$Exitnow = GUICtrlCreateButton("Exit Now", 312, 208, 75, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clear
            GUICtrlSetData($Link, "")
        Case $Check
            FileWrite ("C:\linklist.txt", GUICtrlRead ($Link))
            GUIDelete ()
            Check()
        Case $Exitnow
            Exit
    EndSwitch
WEnd

Func Check()
Local $Filelink = ("C:\linklist.txt")
For $i = 1 To _FileCountLines ($Filelink)
$source = _INetGetSource (FileReadLine ($Filelink,$i))
If StringInStr ($source,"Enter this") Then
;I would to add the online link in the ListView
EndIf
Next
$Form2 = GUICreate("Link Checker", 460, 293, 156, 156)
$List = GUICtrlCreateListView("", 0, 0, 458, 246)
$Add = GUICtrlCreateButton("Add To List", 8, 256, 91, 33, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 120, 256, 91, 33, $WS_GROUP)
$Deselect = GUICtrlCreateButton("Deselect All", 232, 256, 91, 33, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 352, 256, 91, 33, $WS_GROUP)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Add
            ;I would to add the select online link in a file
        Case $Select
            ; I would to select all the online link
        Case $Deselect
            ; I would to deselect all the online link
        Case $Exit
            Exit
    EndSwitch
WEnd
EndFunc

I would to create a list view when i can select and deselect the on line file and write the select link in a file. How i do it?

Hello >_<

Share this post


Link to post
Share on other sites



Up, help please!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I've rewrite this code but i've wuold like a little help :D

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <INet.au3>
#include <Array.au3>
Local $controllsource
$Form1 = GUICreate("Add Link Here", 394, 247, 156, 156)
$Link = GUICtrlCreateEdit("", 0, 0, 393, 201)
$Clear = GUICtrlCreateButton("Clear", 120, 208, 75, 33, $WS_GROUP)
$Check = GUICtrlCreateButton("Check Now!", 216, 208, 75, 33, $WS_GROUP)
$Exitnow = GUICtrlCreateButton("Exit Now", 312, 208, 75, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clear
            GUICtrlSetData($Link, "")
        Case $Check
            Linkcheck (GUICtrlRead ($Link))
        Case $Exitnow
            Exit
    EndSwitch
WEnd
Func Linkcheck ($sLinks)
$aLinks = StringSplit(StringReplace($sLinks, @CR, ""), @LF)
 For $i = 1 To $aLinks[0]
    $number = _ArrayUnique ($aLinks)
    Dim $listitem[$number[0] + 1]
$controllsource = _INetGetSource ($aLinks[$i])
$_1 = GUICreate("Link Checker", 461, 294, 184, 156)
$List = GUICtrlCreateListView("Link|Titolo|Stato", 0, 0, 458, 246, $LVS_EX_CHECKBOXES + $WS_EX_CLIENTEDGE)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 220)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Add = GUICtrlCreateButton("Add To List", 8, 256, 91, 33, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 120, 256, 91, 33, $WS_GROUP)
$Deselect = GUICtrlCreateButton("Deselect All", 232, 256, 91, 33, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 352, 256, 91, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
If StringInStr ($controllsource,"Enter this") Then
    $Titlesource =_INetGetSource ("http://www.xxxxxx.com/?url=" & $aLinks[$i])
    $Title = StringTrimLeft($Titlesource,StringInStr($Titlesource,'/',0,-1))
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & $Title & "|" & "Online",$List)
    GUICtrlSetState($listitem[$i], $GUI_CHECKED)
EndIf
If Not StringInStr ($controllsource,"Enter this") Then
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & "//" & "|" & "Offline",$List) ;This don't work
EndIf
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Add
        ;How to do this? I would write in a text file only the online links.
    Case $Select
        For $x = 1 To $number[0]
        GUICtrlSetState($listitem[$i], $GUI_UNCHECKED)
        Next
    Case $Deselect
        For $x = 1 To $number[0]
        GUICtrlSetState($listitem[$i], $GUI_CHECKED)
        Next
        Case $Exit
        Exit
        EndSwitch
        WEnd
EndFunc

I would create a listview with check box, but my code don't do it. How i do it?..My script when check the >2 links don't show me all links in listview but refresh the list at all link. How to fix it?...I would add the online link in a text file, how i do it?

Excsuse my from my question ;D

Hello!

Edited by AuToItItAlIaNlOv3R

Share this post


Link to post
Share on other sites

Up, help please

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Up, help please

Please do not bump any topic within 24 hrs of posting. Be patient Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I would create a listview with check box, but my code don't do it. How i do it?

change this:

$List = GUICtrlCreateListView("Link|Titolo|Stato", 0, 0, 458, 246, $LVS_EX_CHECKBOXES + $WS_EX_CLIENTEDGE)

to this :

$List = GUICtrlCreateListView("Link|Titolo|Stato", 0, 0, 458, 246, "",$LVS_EX_CHECKBOXES + $WS_EX_CLIENTEDGE)

that will get you checkboxes in list view.

Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

The actually code is this :

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <INet.au3>
#include <Array.au3>
Local $controllsource
$Form1 = GUICreate("Add Link Here", 394, 247, 156, 156)
$Link = GUICtrlCreateEdit("", 0, 0, 393, 201)
$Clear = GUICtrlCreateButton("Clear", 120, 208, 75, 33, $WS_GROUP)
$Check = GUICtrlCreateButton("Check Now!", 216, 208, 75, 33, $WS_GROUP)
$Exitnow = GUICtrlCreateButton("Exit Now", 312, 208, 75, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clear
            GUICtrlSetData($Link, "")
        Case $Check
            Linkcheck (GUICtrlRead ($Link))
        Case $Exitnow
            Exit
    EndSwitch
WEnd
Func Linkcheck ($sLinks)
$aLinks = StringSplit(StringReplace($sLinks, @CR, ""), @LF)
 For $i = 1 To $aLinks[0]
Dim $listitem[$aLinks[0] + 1]
$controllsource = _INetGetSource ($aLinks[$i])
$_1 = GUICreate("Link Checker", 461, 294, 184, 156)
$List = GUICtrlCreateListView("Link|Title|State", 0, 0, 458, 246, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 220)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Add = GUICtrlCreateButton("Add To List", 8, 256, 91, 33, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 120, 256, 91, 33, $WS_GROUP)
$Deselect = GUICtrlCreateButton("Deselect All", 232, 256, 91, 33, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 352, 256, 91, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
If StringInStr ($controllsource,"Enter this") Then ;It controll if the file are online
    $Titlesource =_INetGetSource ("http://www.xxxxxx.com/?url=" & $aLinks[$i])
    $Title = StringTrimLeft($Titlesource,StringInStr($Titlesource,'/',0,-1))
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & $Title & "|" & "Online",$List)
    GUICtrlSetState($listitem[$i], $GUI_CHECKED)
EndIf
If Not StringInStr ($controllsource,"Enter this") Then ;It controll if the file are not online
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & "//" & "|" & "Offline",$List) ;This don't work
EndIf
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Add
        For $i = 1 To $aLinks[0]
            If BitOR(GUICtrlRead($listitem[0], 1), $GUI_CHECKED) = $GUI_CHECKED Then
            FileWriteLine("C:\onlinefile.txt", $aLinks[$i]) ;I wold write the on line file in an array how to do it??
            EndIf
            Next
    Case $Select
        For $x = 1 To $aLinks[0]
        GUICtrlSetState($listitem[$x], $GUI_CHECKED)
        Next
    Case $Deselect
        For $x = 1 To $aLinks[0]
        GUICtrlSetState($listitem[$x], $GUI_UNCHECKED)
        Next
        Case $Exit
        Exit
        EndSwitch
        WEnd
EndFunc

The script work for just 1 link to controll, if a would like to controll more than a link, the script refresh the list at all next link, how to fix it?...,And ultimate help, how i can write a online checked file in an array?

Thank's for the help!

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

My script when check the >2 links don't show me all links in listview but refresh the list at all link.

Remove ur GUI create functions out of the for loop.. its creating more than 1 gui.. I gotta go now.. PM me..

Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

it true i inclide Guicreate in for cicle :D, now i've this code

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <INet.au3>
#include <Array.au3>
$_1 = GUICreate("Link Checker", 461, 294, 184, 156)
$List = GUICtrlCreateListView("Link|Title|State", 0, 0, 458, 246, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 220)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Add = GUICtrlCreateButton("Add To List", 8, 256, 91, 33, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 120, 256, 91, 33, $WS_GROUP)
$Deselect = GUICtrlCreateButton("Deselect All", 232, 256, 91, 33, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 352, 256, 91, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
$aLinks = StringSplit(StringReplace($sLinks, @CR, ""), @LF)
For $i = 1 To $aLinks[0]
Dim $listitem[$aLinks[0] + 1]
$sorgentedacontrollare = _INetGetSource ($aLinks[$i])
If StringInStr ($sorgentedacontrollare,"Enter this") Then
    $Sorgentetitolo =_INetGetSource ("http://www.xxxxxx.com/?url=" & $aLinks[$i])
    $Titoloonline = StringTrimLeft($Sorgentetitolo,StringInStr($Sorgentetitolo,'/',0,-1))
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & $Titoloonline & "|" & "Online",$List)
    GUICtrlSetState($listitem[$i], $GUI_CHECKED)
EndIf
If Not StringInStr ($sorgentedacontrollare,"Enter this") Then
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & "//" & "|" & "Offline",$List) ;This don't work
EndIf
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Add
        For $i = 1 To $aLinks[0]
            If BitOR(GUICtrlRead($listitem[$i], 1), $GUI_CHECKED) = $GUI_CHECKED Then
            FileWriteLine("C:\onlinefile.txt", $aLinks[$i]);i would to write the online select link in an array
            EndIf
        Next
    Case $Select ;Don't work fine it select only last link 
        For $x = 1 To $aLinks[0]
        GUICtrlSetState($listitem[$x], $GUI_CHECKED)
    Next
    Case $Deselect ;Don't work fine it deselect only last link 
        For $x = 1 To $aLinks[0]
        GUICtrlSetState($listitem[$x], $GUI_UNCHECKED)
    Next
        Case $Exit
        Exit
        EndSwitch
        WEnd

But if i click "Select All" or "Deselect All" button the scrip select or deselect only last link but not alla link, how i fix it ?...And i would like to save the selected online link in array how to do it?...And in offline i would block checkbox how i do it?

Thank's a lot Manjish for your help!

Edited by AuToItItAlIaNlOv3R

Share this post


Link to post
Share on other sites

Up please :D

Share this post


Link to post
Share on other sites

I've fixed "Select All" or "Deselect All" buttons, but now if i click on "Add To List" it write all link, but i would like to write in an array onlny online checked link...I would like to block the checkbox in offline link, how to do this?

Thank's a lot

This is the currently code

#include <GUIConstants.au3>
#Include <GuiListView.au3>
#include <INet.au3>
#include <ListViewConstants.au3>
#Include <GuiListView.au3>
#include <GuiConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $controllsource
$Form1 = GUICreate("Add Link Here", 394, 247, 156, 156)
$Link = GUICtrlCreateEdit("", 0, 0, 393, 201)
$Clear = GUICtrlCreateButton("Clear", 120, 208, 75, 33, $WS_GROUP)
$Check = GUICtrlCreateButton("Check Now!", 216, 208, 75, 33, $WS_GROUP)
$Exitnow = GUICtrlCreateButton("Exit Now", 312, 208, 75, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clear
            GUICtrlSetData($Link, "")
        Case $Check
            Linkcheck (GUICtrlRead ($Link))
        Case $Exitnow
            Exit
    EndSwitch
WEnd


Func Linkcheck ($sLinks)
$_1 = GUICreate("Link Checker", 461, 294, 184, 156)
$List = GUICtrlCreateListView("Link|Title|State", 0, 0, 458, 246, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 220)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Add = GUICtrlCreateButton("Add To List", 8, 256, 91, 33, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 120, 256, 91, 33, $WS_GROUP)
$Deselect = GUICtrlCreateButton("Deselect All", 232, 256, 91, 33, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 352, 256, 91, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
$aLinks = StringSplit(StringReplace($sLinks, @CR, ""), @LF)
For $i = 1 To $aLinks[0]
Dim $listitem[$aLinks[0] + 1]
$sorgentedacontrollare = _INetGetSource ($aLinks[$i])
If StringInStr ($sorgentedacontrollare,"Enter this") Then
    $Sorgentetitolo =_INetGetSource ("http://www.xxxxxxx.com.php?url=" & $aLinks[$i])
    $Titoloonline = StringTrimLeft($Sorgentetitolo,StringInStr($Sorgentetitolo,'/',0,-1))
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & $Titoloonline & "|" & "Online",$List)
    GUICtrlSetState($listitem[$i], $GUI_CHECKED)
EndIf
If Not StringInStr ($sorgentedacontrollare,"Enter this") Then
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & "//" & "|" & "Offline",$List) ;This don't work
    GUICtrlSetState($listitem[$i],$GUI_DISABLE)
EndIf
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Add
        For $i = 1 To $aLinks[0]
            If BitOR(GUICtrlRead($listitem[$i]), $GUI_CHECKED) = $GUI_CHECKED Then ;This function don't work, it write all link
            FileWriteLine("C:\onlinefile.txt", $aLinks[$i]) ;I would like to write the online selected link in an array
            EndIf
        Next
    Case $Select
        For $x = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($List,-1)
    Next
    Case $Deselect
        For $y = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($List,-1,False)
    Next
        Case $Exit
        Exit
        EndSwitch
        WEnd
EndFunc

Hello!

Share this post


Link to post
Share on other sites

Up please

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Hi,

I usually am out during weekends. So am not active on forums, during this time. I have solved 2 out of your 3 problems.

#include <GUIConstants.au3>
#Include <GuiListView.au3>
#include <INet.au3>
#include <ListViewConstants.au3>
#Include <GuiListView.au3>
#include <GuiConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $j=1,$ArrayOL[1000]
Local $controllsource
$Form1 = GUICreate("Add Link Here", 394, 247, 156, 156)
$Link = GUICtrlCreateEdit("", 0, 0, 393, 201)
$Clear = GUICtrlCreateButton("Clear", 120, 208, 75, 33, $WS_GROUP)
$Check = GUICtrlCreateButton("Check Now!", 216, 208, 75, 33, $WS_GROUP)
$Exitnow = GUICtrlCreateButton("Exit Now", 312, 208, 75, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clear
            GUICtrlSetData($Link, "")
        Case $Check
            Linkcheck (GUICtrlRead ($Link))
        Case $Exitnow
            Exit
    EndSwitch
WEnd


Func Linkcheck ($sLinks)
$_1 = GUICreate("Link Checker", 461, 294, 184, 156)
$List = GUICtrlCreateListView("Link|Title|State", 0, 0, 458, 246, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 220)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Add = GUICtrlCreateButton("Add To List", 8, 256, 91, 33, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 120, 256, 91, 33, $WS_GROUP)
$Deselect = GUICtrlCreateButton("Deselect All", 232, 256, 91, 33, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 352, 256, 91, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
$aLinks = StringSplit(StringReplace($sLinks, @CR, ""), @LF)
For $i = 1 To $aLinks[0]
Dim $listitem[$aLinks[0] + 1]
$sorgentedacontrollare = _INetGetSource ($aLinks[$i])
If StringInStr ($sorgentedacontrollare,"Enter this") Then
    $Sorgentetitolo =_INetGetSource ("http://www.xxxxxxx.com.php?url=" & $aLinks[$i])
    $Titoloonline = StringTrimLeft($Sorgentetitolo,StringInStr($Sorgentetitolo,'/',0,-1))
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & $Titoloonline & "|" & "Online",$List)
    $ArrayOL[$j]=$aLinks[$i]; <MANJISH> this will write your online links to array $ArrayOL
    $j=$j+1
    GUICtrlSetState($listitem[$i], $GUI_CHECKED)
EndIf
If Not StringInStr ($sorgentedacontrollare,"Enter this") Then
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & "//" & "|" & "Offline",$List) ;<MANJISH> Will check into this and let you know
    
    GUICtrlSetState($listitem[$i],$GUI_nofocus)
EndIf
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Add
        For $i = 1 To $aLinks[0]
            If BitAND(GUICtrlGetState($listitem[$i]), $GUI_CHECKED) = $GUI_CHECKED Then ; <MANJISH> Now it will work
            FileWriteLine("C:\onlinefile.txt", $aLinks[$i])
            EndIf
        Next
    Case $Select
        For $x = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($List,-1)
    Next
    Case $Deselect
        For $y = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($List,-1,False)
    Next
        Case $Exit
        Exit
        EndSwitch
        WEnd
EndFunc

You can try to solve No.2 on you own!! I will check into it and let you know.

Cheers,

M

Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Thank's for the help but with this code don't work fine.

#include <GUIConstants.au3>
#Include <GuiListView.au3>
#include <INet.au3>
#include <ListViewConstants.au3>
#Include <GuiListView.au3>
#include <GuiConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $j=1,$ArrayOL[1000]
Local $controllsource
$Form1 = GUICreate("Add Link Here", 394, 247, 156, 156)
$Link = GUICtrlCreateEdit("", 0, 0, 393, 201)
$Clear = GUICtrlCreateButton("Clear", 120, 208, 75, 33, $WS_GROUP)
$Check = GUICtrlCreateButton("Check Now!", 216, 208, 75, 33, $WS_GROUP)
$Exitnow = GUICtrlCreateButton("Exit Now", 312, 208, 75, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clear
            GUICtrlSetData($Link, "")
        Case $Check
            Linkcheck (GUICtrlRead ($Link))
        Case $Exitnow
            Exit
    EndSwitch
WEnd


Func Linkcheck ($sLinks)
$_1 = GUICreate("Link Checker", 461, 294, 184, 156)
$List = GUICtrlCreateListView("Link|Title|State", 0, 0, 458, 246, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 220)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Add = GUICtrlCreateButton("Add To List", 8, 256, 91, 33, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 120, 256, 91, 33, $WS_GROUP)
$Deselect = GUICtrlCreateButton("Deselect All", 232, 256, 91, 33, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 352, 256, 91, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
$aLinks = StringSplit(StringReplace($sLinks, @CR, ""), @LF)
For $i = 1 To $aLinks[0]
Dim $listitem[$aLinks[0] + 1]
$sorgentedacontrollare = _INetGetSource ($aLinks[$i])
If StringInStr ($sorgentedacontrollare,"Enter this") Then
    $Sorgentetitolo =_INetGetSource ("http://www.xxxxxxx.com.php?url=" & $aLinks[$i])
    $Titoloonline = StringTrimLeft($Sorgentetitolo,StringInStr($Sorgentetitolo,'/',0,-1))
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & $Titoloonline & "|" & "Online",$List)
    $ArrayOL[$j]=$aLinks[$i]; <MANJISH> this will write your online links to array $ArrayOL
    $j=$j+1
    GUICtrlSetState($listitem[$i], $GUI_CHECKED)
EndIf
If Not StringInStr ($sorgentedacontrollare,"Enter this") Then
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & "//" & "|" & "Offline",$List) ;<MANJISH> Will check into this and let you know
    GUICtrlSetState($listitem[$i],$GUI_nofocus);this don't work
EndIf
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Add
        For $i = 1 To $aLinks[0]
            If BitAND(GUICtrlGetState($listitem[$i]), $GUI_CHECKED) = $GUI_CHECKED Then ; <MANJISH> Now it will work
            FileWriteLine("C:\onlinefile.txt", $aLinks[$i]) ;I would like to write online cheked link in an array
            EndIf
        Next
    Case $Select
        For $x = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($List,-1)
    Next
    Case $Deselect
        For $y = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($List,-1,False)
    Next
        Case $Exit
        Exit
        EndSwitch
        WEnd
EndFunc

Posted Image

I wolud to disable the check box of online link :D...I would like to write online check link in an array when i push "Add To List", how i do it?

Thank's a lot for you help! :D

Edited by AuToItItAlIaNlOv3R

Share this post


Link to post
Share on other sites

Well,

I think if u look closely at the code, I have shown how you can write the entries into an array.. Ok now the question is how to determine which link is selected, right? well there is a function which can help us here. It's called _GUICtrlListView_GetItemSelected().

You might wanna check in help file about this and put it in your code.

Ok about disabling the offline links, I still am working on it. Give me some time to figure out the solution.

Also, it's a bit impolite to say:

this code don't work fine.

You might wanna refrain from such statements. It's very hard to make out what you want, coz of your english and the way you explain things. I am doing my best to understand it. If I miss something, then be polite and ask me what you need.


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

You might wanna refrain from such statements. It's very hard to make out what you want, coz of your english and the way you explain things. I am doing my best to understand it. If I miss something, then be polite and ask me what you need.

Exsuse me for my bad english, but in my state we don't speak English.

I've look for _GUICtrlListView_GetItemSelected()function but I've no idea how to use it.Any method that i've used the program writes links, but i would like to write only checked online link. Can you help me to do this?...

About disabling the offline links i look your answers.

Thank's a lot for the help that you give to me.

Regards from AuToItItAlIaNlOv3R

Share this post


Link to post
Share on other sites

Here:

#include <GUIConstants.au3>
#Include <GuiListView.au3>
#include <INet.au3>
#include <ListViewConstants.au3>
#Include <GuiListView.au3>
#include <GuiConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $j=1,$ArrayOL[1000]
Local $controllsource
$Form1 = GUICreate("Add Link Here", 394, 247, 156, 156)
$Link = GUICtrlCreateEdit("", 0, 0, 393, 201)
$Clear = GUICtrlCreateButton("Clear", 120, 208, 75, 33, $WS_GROUP)
$Check = GUICtrlCreateButton("Check Now!", 216, 208, 75, 33, $WS_GROUP)
$Exitnow = GUICtrlCreateButton("Exit Now", 312, 208, 75, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clear
            GUICtrlSetData($Link, "")
        Case $Check
            Linkcheck (GUICtrlRead ($Link))
        Case $Exitnow
            Exit
    EndSwitch
WEnd


Func Linkcheck ($sLinks)
$_1 = GUICreate("Link Checker", 461, 294, 184, 156)
$List = GUICtrlCreateListView("Link|Title|State", 0, 0, 458, 246, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 220)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Add = GUICtrlCreateButton("Add To List", 8, 256, 91, 33, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 120, 256, 91, 33, $WS_GROUP)
$Deselect = GUICtrlCreateButton("Deselect All", 232, 256, 91, 33, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 352, 256, 91, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
$aLinks = StringSplit(StringReplace($sLinks, @CR, ""), @LF)
For $i = 1 To $aLinks[0]
Dim $listitem[$aLinks[0] + 1]
$sorgentedacontrollare = _INetGetSource ($aLinks[$i])
If StringInStr ($sorgentedacontrollare,"Enter this") Then
    $Sorgentetitolo =_INetGetSource ("http://www.xxxxxxx.com.php?url=" & $aLinks[$i])
    $Titoloonline = StringTrimLeft($Sorgentetitolo,StringInStr($Sorgentetitolo,'/',0,-1))
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & $Titoloonline & "|" & "Online",$List)
    GUICtrlSetState($listitem[$i], $GUI_CHECKED)
EndIf
If Not StringInStr ($sorgentedacontrollare,"Enter this") Then
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & "//" & "|" & "Offline",$List) ;<MANJISH> Will check into this and let you know
    GUICtrlSetState($listitem[$i],$GUI_nofocus);this don't work
EndIf
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Add
        For $i = 1 To $aLinks[0]
            If _GUICtrlListView_GetItemChecked($list,$i-1)=1 Then ; <MANJISH> This is how you use _GUICtrlListView_GetItemChecked()
            $ArrayOL[$j]=$aLinks[$i]; <MANJISH> this will write your checked online links to array $ArrayOL
            $j=$j+1
            ;FileWriteLine("C:\onlinefile.txt", $aLinks[$i]) 
            EndIf
        Next
        _ArrayDisplay($ArrayOL)
    Case $Select
        For $x = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($List,-1)
    Next
    Case $Deselect
        For $y = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($List,-1,False)
    Next
        Case $Exit
        Exit
        EndSwitch
        WEnd
EndFunc

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

Manjish thank's a lot. The script now work fine... About disabling the offline links i look your answers, ok?

Thank's!

Share this post


Link to post
Share on other sites

@Manjish

I modified the code, i set offline link in another listview but now the script don't write in an array the online checked link. Can you help me?

This is the code

#include <GUIConstants.au3>
#Include <GuiListView.au3>
#include <INet.au3>
#include <ListViewConstants.au3>
#Include <GuiListView.au3>
#include <GuiConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

;==========
Global $j=1,$ArrayOL[1000]
Local $controllsource
$Form1 = GUICreate("Add Link Here", 394, 247, 156, 156)
$Link = GUICtrlCreateEdit("", 0, 0, 393, 201)
$Clear = GUICtrlCreateButton("Clear", 120, 208, 75, 33, $WS_GROUP)
$Check = GUICtrlCreateButton("Check Now!", 216, 208, 75, 33, $WS_GROUP)
$Exitnow = GUICtrlCreateButton("Exit Now", 312, 208, 75, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clear
            GUICtrlSetData($Link, "")
        Case $Check
            Linkcheck (GUICtrlRead ($Link))
        Case $Exitnow
            Exit
    EndSwitch
WEnd


Func Linkcheck ($sLinks)
$_1 = GUICreate("Link Checker", 653, 244, 31, 65)
$Listonline = GUICtrlCreateListView("Link|Title|State", 8, 40, 282, 150,-1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 255)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 219)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Listoffline = GUICtrlCreateListView("Link|Title|State", 336, 40, 282, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 255)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 219)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 84)
$Label1 = GUICtrlCreateLabel("Online Links", 8, 16, 62, 17)
$Label2 = GUICtrlCreateLabel("Offline Links", 336, 16, 62, 17)
$Deselect = GUICtrlCreateButton("Deselect All", 456, 208, 75, 25, $WS_GROUP)
$Select = GUICtrlCreateButton("Select All", 368, 208, 75, 25, $WS_GROUP)
$Exit = GUICtrlCreateButton("Exit", 544, 208, 75, 25, $WS_GROUP)
$Add  = GUICtrlCreateButton("Add to list", 280, 208, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
$aLinks = StringSplit(StringReplace($sLinks, @CR, ""), @LF)
For $i = 1 To $aLinks[0]
Dim $listitem[$aLinks[0] + 1]
$sourcecontroll = _INetGetSource ($aLinks[$i])
If StringInStr ($sourcecontroll,"Enter this") Then
    $Sourcetitle =_INetGetSource ("http:/www.xxxxxx.com" & $aLinks[$i])
   $onlinetitle = StringTrimLeft($Sourcetitle,StringInStr($Sourcetitle,'/',0,-1))
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" &$onlinetitle & "|" & "Online",$Listonline)
    GUICtrlSetState($listitem[$i], $GUI_CHECKED)
EndIf
If Not StringInStr ($sourcecontroll,"Enter this") Then
    $listitem[$i] = GUICtrlCreateListViewItem ($aLinks[$i] & "|" & "//" & "|" & "Offline",$Listoffline)
EndIf
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Add
        For $i = 1 To $aLinks[0]
            If _GUICtrlListView_GetItemChecked($Listonline,$i-1)=1 Then 
            $ArrayOL[$j]=$aLinks[$i] ;Don't write the online checked link
            $j=$j+1
            EndIf
        Next
        _ArrayDisplay($ArrayOL)
    Case $Select
        For $x = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($Listonline,-1)
    Next
    Case $Deselect
        For $y = 1 To $aLinks[0]
        _GUICtrlListView_SetItemChecked($Listonline,-1,False)
    Next
        Case $Exit
        Exit
        EndSwitch
        WEnd
EndFunc

This script don't write in an array the online checked link, how to fix it.

Thank's a lot

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