Necesita Autoit la herramienta principal.
1º Creamos un proyecto Autoit, añadimos las librerias.
[ide="autohotkey"]
[You must be registered and logged in to see this link.] <ButtonConstants.au3>
[You must be registered and logged in to see this link.] <EditConstants.au3>
[You must be registered and logged in to see this link.] <GUIConstantsEx.au3>
[You must be registered and logged in to see this link.] <GUIListBox.au3>
[You must be registered and logged in to see this link.] <WindowsConstants.au3>
[You must be registered and logged in to see this link.] <Array.au3>
[/ide]
2º Creamos el GUI,pueden hacer uno diferente, con la herramienta Koda, que esta en la pagina web. Instalando el "Autoit Editor"
[ide="autohotkey"]
[You must be registered and logged in to see this link.] ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("HS4L-FIXING ARRAY", 309, 162, 275, 373)
$cList_1 = GUICtrlCreateList("", 16, 32, 153, 110)
GUICtrlSetData(-1, "")
$Input1 = GUICtrlCreateInput("Old_AOB", 184, 32, 113, 21)
$Input2 = GUICtrlCreateInput("New_AOB", 184, 64, 113, 21)
$Button1 = GUICtrlCreateButton("to fix array", 184, 104, 105, 41)
$Label1 = GUICtrlCreateLabel("double click to copy", 17, 8, 99, 17)
GUISetState(@SW_SHOW)
[You must be registered and logged in to see this link.] ### END Koda GUI section ###
[/ide]
3º Añadimos un "CONTEXT MENU" Despues de acabar con el GUI
[ide="autohotkey"]
$MENU = GUICTRLCREATECONTEXTMENU($cList_1)
$MENU1 = GUICTRLCREATEMENUITEM("Delete", $MENU)
$MENU2 = GUICTRLCREATEMENUITEM("Save", $MENU)
[/ide]
4º Procesar el menú de aplicaciones
C++ "WM_COMMAND"
FUNCIÓN: WndProc(HWND hWnd, UINT iMsgh, WPARAM wParam, LPARAM lParam)
Autoit "$WM_COMMAND"
FUNCIÓN: WndProc($hWnd, $iMsg, $wParam, $lParam)
Esto es despues del "CONTEXT MENU"
[ide="autohotkey"]
GUIRegisterMsg($WM_COMMAND, "WndProc")
[/ide]
Aquí analiza la selecion de menú
[ide="autohotkey"]
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
IF GuiCtrlRead($Input1) == "Old_AOB" or GuiCtrlRead($Input2) == "New_AOB" Then
MsgBox(16,"","Write the array")
ElseIf StringLen(GuiCtrlRead($Input1)) <> StringLen(GuiCtrlRead($Input2)) Then
MsgBox(16,"Error","doesn't have it's about the same size")
If StringInStr(GuiCtrlRead($Input1)," ") <> 0 or StringInStr(GuiCtrlRead($Input2)," ") <> 0 Then
MsgBox(16,"Error","doesn't have space size")
EndIf
Else
Local $AOB1 = StringSplit(GUICtrlRead($Input1), " ")
Local $AOB2 = StringSplit(GUICtrlRead($Input2), " ")
Local $Arrayfinish
If StringLen($AOB1[1]) == StringLen($AOB2[1]) Then
For $i = 1 To $AOB1[0]
if($AOB1[$i] == $AOB2[$i]) Then
$Arrayfinish = $Arrayfinish&$AOB1[$i] & " "
ExitLoop ;Esto es para salir del bucle, no crear doble texto
Else
$Arrayfinish&= "??" & " "
EndIf
Next
$HS4LListRead = _GUICtrlListBox_AddString($cList_1,$Arrayfinish)
$Arrayfinish="" ;Resetea la variable
Endif
EndIf
Case $MENU1 ;Delete
IF _GUICtrlListBox_GetCount($cList_1) <> 0 Then
_GUICtrlListBox_DeleteString($cList_1,_GUICtrlListBox_GetCaretIndex($cList_1))
Else
MsgBox(0, "", "can't find array")
EndIf
Case $MENU2 ;save
if _GUICtrlListBox_GetCount($cList_1) <> 0 Then
IF $FileSaveON == True Then ; Si ya guardado
IniWriteSection($Directorio,"HS4L",_GUICtrlListBox_GetText($cList_1, _GUICtrlListBox_GetCaretIndex($cList_1)))
MsgBox(0,"",$Directorio)
Else ; Si no a guardado
Local $sFileSaveDialog = FileSaveDialog("HS4L", @ScriptDir, "File (*.txt*)", $FD_PATHMUSTEXIST)
If @error Then
MsgBox(0, "", "No file was saved.")
Else
$sText = _GUICtrlListBox_GetText($cList_1, _GUICtrlListBox_GetCaretIndex($cList_1))
IniWriteSection($sFileSaveDialog,"HS4L",$sText)
Global $FileSaveON = True
Global $Directorio = $sFileSaveDialog
EndIf
EndIf
Else
MsgBox(0, "", "can't find array")
EndIf
[/ide]
5º Aqui el procesar mensajes de la ventana principal
[ide="autohotkey"]
Func WndProc($hWnd, $iMsg, $wParam, $lParam)
[You must be registered and logged in to see this link.] $hWnd, $iMsg, $lParam
$iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
$iCode = BitShift($wParam, 16) ; Hi Word
Switch $iCode
Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
Switch $iIDFrom
Case $cList_1
$iIndex = _GUICtrlListBox_GetCaretIndex($cList_1)
$sText = _GUICtrlListBox_GetText($cList_1, $iIndex)
ClipPut($sText)
MsgBox(32,"HS4L","is copying")
EndSwitch
EndSwitch
EndFunc
[/ide]
No explicado el codigo interno muy detallado,pero cuando tenga tiempo. Dejare el código completo aquí abajo.
[ide="autohotkey"]
[You must be registered and logged in to see this link.] <ButtonConstants.au3>
[You must be registered and logged in to see this link.] <EditConstants.au3>
[You must be registered and logged in to see this link.] <GUIConstantsEx.au3>
[You must be registered and logged in to see this link.] <GUIListBox.au3>
[You must be registered and logged in to see this link.] <WindowsConstants.au3>
[You must be registered and logged in to see this link.] <Array.au3>
MsgBox(32,"HS4L","Version: 1.0" & @CRLF & "By alexmen10")
[You must be registered and logged in to see this link.] ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("HS4L-FIXING ARRAY", 309, 162, 275, 373)
$cList_1 = GUICtrlCreateList("", 16, 32, 153, 110)
GUICtrlSetData(-1, "")
$Input1 = GUICtrlCreateInput("Old_AOB", 184, 32, 113, 21)
$Input2 = GUICtrlCreateInput("New_AOB", 184, 64, 113, 21)
$Button1 = GUICtrlCreateButton("to fix array", 184, 104, 105, 41)
$Label1 = GUICtrlCreateLabel("double click to copy", 17, 8, 99, 17)
GUISetState(@SW_SHOW)
[You must be registered and logged in to see this link.] ### END Koda GUI section ###
$MENU = GUICTRLCREATECONTEXTMENU($cList_1)
$MENU1 = GUICTRLCREATEMENUITEM("Delete", $MENU)
$MENU2 = GUICTRLCREATEMENUITEM("Save", $MENU)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
Global $FileSaveON = False
Global $Directorio = ""
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
IF GuiCtrlRead($Input1) == "Old_AOB" or GuiCtrlRead($Input2) == "New_AOB" Then
MsgBox(16,"","Write the array")
ElseIf StringLen(GuiCtrlRead($Input1)) <> StringLen(GuiCtrlRead($Input2)) Then
MsgBox(16,"Error","doesn't have it's about the same size")
If StringInStr(GuiCtrlRead($Input1)," ") <> 0 or StringInStr(GuiCtrlRead($Input2)," ") <> 0 Then
MsgBox(16,"Error","doesn't have space size")
EndIf
Else
Local $AOB1 = StringSplit(GUICtrlRead($Input1), " ")
Local $AOB2 = StringSplit(GUICtrlRead($Input2), " ")
Local $Arrayfinish
If StringLen($AOB1[1]) == StringLen($AOB2[1]) Then
For $i = 1 To $AOB1[0]
if($AOB1[$i] == $AOB2[$i]) Then
$Arrayfinish = $Arrayfinish&$AOB1[$i] & " "
ExitLoop ;Esto es para salir del bucle, no crear doble texto
Else
$Arrayfinish&= "??" & " "
EndIf
Next
$HS4LListRead = _GUICtrlListBox_AddString($cList_1,$Arrayfinish)
$Arrayfinish="" ;Resetea la variable
Endif
EndIf
Case $MENU1 ;Delete
IF _GUICtrlListBox_GetCount($cList_1) <> 0 Then
_GUICtrlListBox_DeleteString($cList_1,_GUICtrlListBox_GetCaretIndex($cList_1))
Else
MsgBox(0, "", "can't find array")
EndIf
Case $MENU2 ;save
if _GUICtrlListBox_GetCount($cList_1) <> 0 Then
IF $FileSaveON == True Then ; Si ya guardado
IniWriteSection($Directorio,"HS4L",_GUICtrlListBox_GetText($cList_1, _GUICtrlListBox_GetCaretIndex($cList_1)))
MsgBox(0,"",$Directorio)
Else ; Si no a guardado
Local $sFileSaveDialog = FileSaveDialog("HS4L", @ScriptDir, "File (*.txt*)", $FD_PATHMUSTEXIST)
If @error Then
MsgBox(0, "", "No file was saved.")
Else
$sText = _GUICtrlListBox_GetText($cList_1, _GUICtrlListBox_GetCaretIndex($cList_1))
IniWriteSection($sFileSaveDialog,"HS4L",$sText)
Global $FileSaveON = True
Global $Directorio = $sFileSaveDialog
EndIf
EndIf
Else
MsgBox(0, "", "can't find array")
EndIf
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
[You must be registered and logged in to see this link.] $hWnd, $iMsg, $lParam
$iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
$iCode = BitShift($wParam, 16) ; Hi Word
Switch $iCode
Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
Switch $iIDFrom
Case $cList_1
$iIndex = _GUICtrlListBox_GetCaretIndex($cList_1)
$sText = _GUICtrlListBox_GetText($cList_1, $iIndex)
ClipPut($sText)
MsgBox(32,"HS4L","is copying")
EndSwitch
EndSwitch
EndFunc
[/ide]
- Spoiler:
- [You must be registered and logged in to see this link.]
1º Creamos un proyecto Autoit, añadimos las librerias.
[ide="autohotkey"]
[You must be registered and logged in to see this link.] <ButtonConstants.au3>
[You must be registered and logged in to see this link.] <EditConstants.au3>
[You must be registered and logged in to see this link.] <GUIConstantsEx.au3>
[You must be registered and logged in to see this link.] <GUIListBox.au3>
[You must be registered and logged in to see this link.] <WindowsConstants.au3>
[You must be registered and logged in to see this link.] <Array.au3>
[/ide]
2º Creamos el GUI,pueden hacer uno diferente, con la herramienta Koda, que esta en la pagina web. Instalando el "Autoit Editor"
- Spoiler:
- [You must be registered and logged in to see this link.]
[ide="autohotkey"]
[You must be registered and logged in to see this link.] ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("HS4L-FIXING ARRAY", 309, 162, 275, 373)
$cList_1 = GUICtrlCreateList("", 16, 32, 153, 110)
GUICtrlSetData(-1, "")
$Input1 = GUICtrlCreateInput("Old_AOB", 184, 32, 113, 21)
$Input2 = GUICtrlCreateInput("New_AOB", 184, 64, 113, 21)
$Button1 = GUICtrlCreateButton("to fix array", 184, 104, 105, 41)
$Label1 = GUICtrlCreateLabel("double click to copy", 17, 8, 99, 17)
GUISetState(@SW_SHOW)
[You must be registered and logged in to see this link.] ### END Koda GUI section ###
[/ide]
3º Añadimos un "CONTEXT MENU" Despues de acabar con el GUI
[ide="autohotkey"]
$MENU = GUICTRLCREATECONTEXTMENU($cList_1)
$MENU1 = GUICTRLCREATEMENUITEM("Delete", $MENU)
$MENU2 = GUICTRLCREATEMENUITEM("Save", $MENU)
[/ide]
4º Procesar el menú de aplicaciones
C++ "WM_COMMAND"
FUNCIÓN: WndProc(HWND hWnd, UINT iMsgh, WPARAM wParam, LPARAM lParam)
Autoit "$WM_COMMAND"
FUNCIÓN: WndProc($hWnd, $iMsg, $wParam, $lParam)
Esto es despues del "CONTEXT MENU"
[ide="autohotkey"]
GUIRegisterMsg($WM_COMMAND, "WndProc")
[/ide]
Aquí analiza la selecion de menú
[ide="autohotkey"]
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
IF GuiCtrlRead($Input1) == "Old_AOB" or GuiCtrlRead($Input2) == "New_AOB" Then
MsgBox(16,"","Write the array")
ElseIf StringLen(GuiCtrlRead($Input1)) <> StringLen(GuiCtrlRead($Input2)) Then
MsgBox(16,"Error","doesn't have it's about the same size")
If StringInStr(GuiCtrlRead($Input1)," ") <> 0 or StringInStr(GuiCtrlRead($Input2)," ") <> 0 Then
MsgBox(16,"Error","doesn't have space size")
EndIf
Else
Local $AOB1 = StringSplit(GUICtrlRead($Input1), " ")
Local $AOB2 = StringSplit(GUICtrlRead($Input2), " ")
Local $Arrayfinish
If StringLen($AOB1[1]) == StringLen($AOB2[1]) Then
For $i = 1 To $AOB1[0]
if($AOB1[$i] == $AOB2[$i]) Then
$Arrayfinish = $Arrayfinish&$AOB1[$i] & " "
ExitLoop ;Esto es para salir del bucle, no crear doble texto
Else
$Arrayfinish&= "??" & " "
EndIf
Next
$HS4LListRead = _GUICtrlListBox_AddString($cList_1,$Arrayfinish)
$Arrayfinish="" ;Resetea la variable
Endif
EndIf
Case $MENU1 ;Delete
IF _GUICtrlListBox_GetCount($cList_1) <> 0 Then
_GUICtrlListBox_DeleteString($cList_1,_GUICtrlListBox_GetCaretIndex($cList_1))
Else
MsgBox(0, "", "can't find array")
EndIf
Case $MENU2 ;save
if _GUICtrlListBox_GetCount($cList_1) <> 0 Then
IF $FileSaveON == True Then ; Si ya guardado
IniWriteSection($Directorio,"HS4L",_GUICtrlListBox_GetText($cList_1, _GUICtrlListBox_GetCaretIndex($cList_1)))
MsgBox(0,"",$Directorio)
Else ; Si no a guardado
Local $sFileSaveDialog = FileSaveDialog("HS4L", @ScriptDir, "File (*.txt*)", $FD_PATHMUSTEXIST)
If @error Then
MsgBox(0, "", "No file was saved.")
Else
$sText = _GUICtrlListBox_GetText($cList_1, _GUICtrlListBox_GetCaretIndex($cList_1))
IniWriteSection($sFileSaveDialog,"HS4L",$sText)
Global $FileSaveON = True
Global $Directorio = $sFileSaveDialog
EndIf
EndIf
Else
MsgBox(0, "", "can't find array")
EndIf
[/ide]
5º Aqui el procesar mensajes de la ventana principal
[ide="autohotkey"]
Func WndProc($hWnd, $iMsg, $wParam, $lParam)
[You must be registered and logged in to see this link.] $hWnd, $iMsg, $lParam
$iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
$iCode = BitShift($wParam, 16) ; Hi Word
Switch $iCode
Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
Switch $iIDFrom
Case $cList_1
$iIndex = _GUICtrlListBox_GetCaretIndex($cList_1)
$sText = _GUICtrlListBox_GetText($cList_1, $iIndex)
ClipPut($sText)
MsgBox(32,"HS4L","is copying")
EndSwitch
EndSwitch
EndFunc
[/ide]
No explicado el codigo interno muy detallado,pero cuando tenga tiempo. Dejare el código completo aquí abajo.
[ide="autohotkey"]
[You must be registered and logged in to see this link.] <ButtonConstants.au3>
[You must be registered and logged in to see this link.] <EditConstants.au3>
[You must be registered and logged in to see this link.] <GUIConstantsEx.au3>
[You must be registered and logged in to see this link.] <GUIListBox.au3>
[You must be registered and logged in to see this link.] <WindowsConstants.au3>
[You must be registered and logged in to see this link.] <Array.au3>
MsgBox(32,"HS4L","Version: 1.0" & @CRLF & "By alexmen10")
[You must be registered and logged in to see this link.] ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("HS4L-FIXING ARRAY", 309, 162, 275, 373)
$cList_1 = GUICtrlCreateList("", 16, 32, 153, 110)
GUICtrlSetData(-1, "")
$Input1 = GUICtrlCreateInput("Old_AOB", 184, 32, 113, 21)
$Input2 = GUICtrlCreateInput("New_AOB", 184, 64, 113, 21)
$Button1 = GUICtrlCreateButton("to fix array", 184, 104, 105, 41)
$Label1 = GUICtrlCreateLabel("double click to copy", 17, 8, 99, 17)
GUISetState(@SW_SHOW)
[You must be registered and logged in to see this link.] ### END Koda GUI section ###
$MENU = GUICTRLCREATECONTEXTMENU($cList_1)
$MENU1 = GUICTRLCREATEMENUITEM("Delete", $MENU)
$MENU2 = GUICTRLCREATEMENUITEM("Save", $MENU)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
Global $FileSaveON = False
Global $Directorio = ""
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
IF GuiCtrlRead($Input1) == "Old_AOB" or GuiCtrlRead($Input2) == "New_AOB" Then
MsgBox(16,"","Write the array")
ElseIf StringLen(GuiCtrlRead($Input1)) <> StringLen(GuiCtrlRead($Input2)) Then
MsgBox(16,"Error","doesn't have it's about the same size")
If StringInStr(GuiCtrlRead($Input1)," ") <> 0 or StringInStr(GuiCtrlRead($Input2)," ") <> 0 Then
MsgBox(16,"Error","doesn't have space size")
EndIf
Else
Local $AOB1 = StringSplit(GUICtrlRead($Input1), " ")
Local $AOB2 = StringSplit(GUICtrlRead($Input2), " ")
Local $Arrayfinish
If StringLen($AOB1[1]) == StringLen($AOB2[1]) Then
For $i = 1 To $AOB1[0]
if($AOB1[$i] == $AOB2[$i]) Then
$Arrayfinish = $Arrayfinish&$AOB1[$i] & " "
ExitLoop ;Esto es para salir del bucle, no crear doble texto
Else
$Arrayfinish&= "??" & " "
EndIf
Next
$HS4LListRead = _GUICtrlListBox_AddString($cList_1,$Arrayfinish)
$Arrayfinish="" ;Resetea la variable
Endif
EndIf
Case $MENU1 ;Delete
IF _GUICtrlListBox_GetCount($cList_1) <> 0 Then
_GUICtrlListBox_DeleteString($cList_1,_GUICtrlListBox_GetCaretIndex($cList_1))
Else
MsgBox(0, "", "can't find array")
EndIf
Case $MENU2 ;save
if _GUICtrlListBox_GetCount($cList_1) <> 0 Then
IF $FileSaveON == True Then ; Si ya guardado
IniWriteSection($Directorio,"HS4L",_GUICtrlListBox_GetText($cList_1, _GUICtrlListBox_GetCaretIndex($cList_1)))
MsgBox(0,"",$Directorio)
Else ; Si no a guardado
Local $sFileSaveDialog = FileSaveDialog("HS4L", @ScriptDir, "File (*.txt*)", $FD_PATHMUSTEXIST)
If @error Then
MsgBox(0, "", "No file was saved.")
Else
$sText = _GUICtrlListBox_GetText($cList_1, _GUICtrlListBox_GetCaretIndex($cList_1))
IniWriteSection($sFileSaveDialog,"HS4L",$sText)
Global $FileSaveON = True
Global $Directorio = $sFileSaveDialog
EndIf
EndIf
Else
MsgBox(0, "", "can't find array")
EndIf
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
[You must be registered and logged in to see this link.] $hWnd, $iMsg, $lParam
$iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
$iCode = BitShift($wParam, 16) ; Hi Word
Switch $iCode
Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
Switch $iIDFrom
Case $cList_1
$iIndex = _GUICtrlListBox_GetCaretIndex($cList_1)
$sText = _GUICtrlListBox_GetText($cList_1, $iIndex)
ClipPut($sText)
MsgBox(32,"HS4L","is copying")
EndSwitch
EndSwitch
EndFunc
[/ide]