J'ai vu qu'il était possible avec une edibox de récupérer la section d'un mot avec _GUICtrlEdit_GetSel
► Afficher le textecode Editbox
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>
Global $selectedData
#Region ### START Koda GUI section ### Form=
Global $_1_1 = GUICreate("", 889, 571, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS))
Global $rapport = GUICtrlCreateInput("", 136, 8, 481, 21)
Global $Path = GUICtrlCreateButton("Parcourir", 632, 8, 75, 25, $WS_GROUP)
Global $Edit = GUICtrlCreateEdit("", 16, 56, 862, 438)
GUICtrlSetState($Edit, $GUI_FOCUS)
Global $SyslogButton = GUICtrlCreateButton("Syslog", 177, 504, 57, 31, $WS_GROUP)
Global $SystemlookupButton = GUICtrlCreateButton("SystemlookUp", 3, 504, 100, 31, $WS_GROUP)
Global $boldButton = GUICtrlCreateButton("StartUpList", 105, 504, 70, 31, $WS_GROUP)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $Path
$OpenDialog = FileOpenDialog("Ouvrir le rapport", @DesktopDir & "\", "rapport (*.txt;*.log)", 1) ; ouverture du fichier placé sur le bureau au format txt, log
GUICtrlSetData($rapport, $OpenDialog) ; controle le fichier de la dialogbox dans l'inputbox$
$file = FileOpen($OpenDialog, 0)
$ligne = FileRead($file)
GUICtrlSetData($Edit, $ligne) ; et on injecte la ligne dans la liste
Case $SyslogButton
MySelection()
ShellExecute("http://www.sysinfo.org/startuplist.php?filter="&$selectedData)
Case $SystemlookupButton
MySelection()
ShellExecute("http://www.systemlookup.com/search.php?type=filename&search="&$selectedData)
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
Sleep(30)
WEnd
Func MySelection()
$SelectedArr = _GUICtrlEdit_GetSel($Edit)
$SelectedArr[0] += 1
$count = $SelectedArr[1] - $SelectedArr[0] + 1
If $count > 0 Then
$allText = _GUICtrlEdit_GetText($Edit)
$selectedData = StringMid($allText, $SelectedArr[0], $count)
EndIf
EndFunc ;==>Replace_MySelection
Mon script charge un fichier txt et lit chaque ligne en ajouter une case à cocher devant.
► Afficher le textecode Listbox
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
Opt("GUIDataSeparatorChar", Chr(0)) ; permet de supprimer le bug du | sur les lignes contenant le symbole |
Global $itemNb, $Item, $RapportFile, $rapport, $ReadFile, $file, $OpenDialog, $EditText, $LigneCochee, $EditTexte, $String1; déclaration des variables
Global $j, $k, $m
#Region ###############Gui Modifié
Global $_1_1 = GUICreate("RapportMe", 888, 570, -1, -1, $WS_OVERLAPPEDWINDOW)
GUICtrlSetResizing($_1_1, $GUI_DOCKAUTO + $GUI_DOCKBOTTOM + $GUI_DOCKTOP)
Global $List1 = GUICtrlCreateListView("Lignes", 8, 40, 784, 300, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_CHECKBOXES))
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 0, 780)
Global $Label0 = GUICtrlCreateLabel("Entrée sélectionnée :", 8, 510, 775, 17)
Global $Label1 = GUICtrlCreateLabel("", 8, 530, 775, 17, $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xFFFFFF)
Global $Syslog = GUICtrlCreateButton("Syslog", 804, 40, 75, 25, $WS_GROUP)
Global $Systemlook = GUICtrlCreateButton("Systemlook", 804, 72, 75, 25, $WS_GROUP)
[color=#008000];menu contextuel pour les lignes.
$iCtxt0 = GUICtrlCreateContextMenu($List1)
$iCtxt1 = GUICtrlCreateMenuItem("SysLog", $List1)
$iCtxt1 = GUICtrlCreateMenuItem("Syslookup", $List1)[/color]
Global $Edit1 = GUICtrlCreateEdit("", 8, 344, 785, 153)
GUICtrlSetData(-1, "")
Global $rapport = GUICtrlCreateInput("", 136, 8, 481, 21)
Global $Path = GUICtrlCreateButton("Parcourir", 632, 8, 75, 25, $WS_GROUP)
Global $Rappor = GUICtrlCreateLabel("Rapport to :", 8, 8, 95, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Do
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Path
$OpenDialog = FileOpenDialog("Ouvrir le rapport", @DesktopDir & "\", "rapport (*.txt;*.log)", 1) ; ouverture du fichier placé sur le bureau au format txt, log
$itemNb = "" ; déclaration de variable vide
$Item = "" ; déclaration de variable vide
GUICtrlSetData($rapport, $OpenDialog) ;
_GUICtrlListView_DeleteAllItems($List1) ;
$file = FileOpen($OpenDialog, 0)
Dim $Item[1] ; on crée un tableau pour stocker les lignes => tableau 1D
$itemNb = 0
While 1 ; donc on fait une boucle
$ligne = FileReadLine($file)
If @error = -1 Then ExitLoop
$Trouve = False ;
If $ligne <> "" Then
$itemNb += 1
ReDim $Item[$itemNb + 1]
$Item[$itemNb] = GUICtrlCreateListViewItem($ligne, $List1) ;
EndIf
WEnd
FileClose($file); A la fin on oublie pas de fermer le fichier
[color=#FF0000]Case $Syslog
$selectedData = ""
ShellExecute("http://www.sysinfo.org/startuplist.php?filter=" & $selectedData)
Case $Systemlook
ShellExecute("http://www.systemlookup.com/search.php?type=filename&search=" & $selectedData)[/color]
Case Else ;
If $OpenDialog <> "" Then
$lbl = "Lignes sélectionnées : "
$LigneCochee = ""
For $i = 0 To $itemNb
If GUICtrlRead($Item[$i], 1) = 1 Then
$lbl = $lbl & ", " & $i
If Not StringInStr($LigneCochee, _GUICtrlListView_GetItemText($List1, $i - 1)) Then
$LigneCochee &= _GUICtrlListView_GetItemText($List1, $i - 1) & @CRLF
EndIf
EndIf
Next
If $lbl = "Lignes sélectionnées : " Then ; si aucun N° de ligne n'a été ajouté...
$lbl = "Aucune ligne sélectionnée" ; ... c'est qu'aucune ligne n'a été sélectionnée
EndIf
If GUICtrlRead($Label1) <> $lbl Then ; pour éviter le scintillement on ne met a jour le label que si il a changé
GUICtrlSetData($Label1, $lbl)
EndIf
EndIf
EndSwitch
Until $nMsg = $GUI_EVENT_CLOSE
Merci à ceux qui m'aideront
bonne journée
Laddy



