Leaderboard
Popular Content
Showing content with the highest reputation on 12/02/2024 in all areas
-
ioa747, The second example looks to be more appropriate! Thanks again! Much appreciated!1 point
-
GUISetHelp Placement
pixelsearch reacted to ioa747 for a topic
or you could take this approach, where things have their place ;~ ----------------------------------------------- #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Global $hGUI = GUICreate("Title", 220, 75) ; ----------------------------------------------- ; COLUMN 1 BUTTONS Global $_sCol1Row1 = GUICtrlCreateButton("Item 1", 10, 10, 200, 25) Global $_sCol1Row2 = GUICtrlCreateButton("Item 1", 10, 40, 200, 25) Global $idUserDocs = GUICtrlCreateDummy() ; ----------------------------------------------- Local $aAccelKeys[1][2] = [["{F1}", $idUserDocs]] GUISetAccelerators($aAccelKeys) ; ----------------------------------------------- GUISetState(@SW_SHOW, $hGUI) ; ----------------------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ; ----------------- ; COLUMN 1 BUTTONS Case $_sCol1Row1 _MyFunction1() Case $_sCol1Row2 _MyFunction2() Case $idUserDocs _UserDocs() EndSwitch WEnd ; ----------------------------------------------- ; COLUMN 1 BUTTONS ; ----------------------------------------------- Func _MyFunction1() MsgBox(0, "", "Inside _MyFunction1") EndFunc ;==>_MyFunction1 ; ----------------------------------------------- Func _MyFunction2() MsgBox(0, "", "Inside _MyFunction2") EndFunc ;==>_MyFunction2 ; ----------------------------------------------- Func _UserDocs() Local $sPdfProgram = "C:\Program Files (x86)\FoxitReader\Foxit Reader.exe" Local $sPdfFile = "C:\Working\TestMe.pdf" ; ----------------------------------------------- ShellExecute($sPdfProgram, $sPdfFile) EndFunc ;==>_UserDocs ; -----------------------------------------------1 point -
I placed it immediately after the appearance of the gui, because that seemed to me the most appropriate position (it could have been included earlier) ;~ ----------------------------------------------- #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Global $hGUI = GUICreate("Title", 220, 75) ; ----------------------------------------------- ; COLUMN 1 BUTTONS Global $_sCol1Row1 = GUICtrlCreateButton("Item 1", 10, 10, 200, 25) Global $_sCol1Row2 = GUICtrlCreateButton("Item 1", 10, 40, 200, 25) ; ----------------------------------------------- GUISetState(@SW_SHOW, $hGUI) _UserDocs() ; ----------------------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ; ----------------- ; COLUMN 1 BUTTONS Case $_sCol1Row1 _MyFunction1() Case $_sCol1Row2 _MyFunction2() EndSwitch WEnd ; ----------------------------------------------- ; COLUMN 1 BUTTONS ; ----------------------------------------------- Func _MyFunction1() MsgBox(0, "", "Inside _MyFunction1") EndFunc ;==>_MyFunction1 ; ----------------------------------------------- Func _MyFunction2() MsgBox(0, "", "Inside _MyFunction2") EndFunc ;==>_MyFunction2 ; ----------------------------------------------- Func _UserDocs() Local $sPdfProgram = "C:\Program Files (x86)\FoxitReader\Foxit Reader.exe" Local $sPdfFile = "C:\Working\TestMe.pdf" ; ----------------------------------------------- GUISetHelp('"' & $sPdfProgram & '" "' & $sPdfFile & '"') EndFunc ;==>_UserDocs ; -----------------------------------------------1 point
-
SSH UDF
PatricWust reacted to p4sCh for a topic
Hello everyone, I've created a UDF for basic communication with SSH servers. I know there is already such a UDF, but I wasn't satisfied with it for my purpose, so I created a new one. This UDF also acts as a wrapper for the plink executable. Its essential functions are _SSHConnect, _SSHSend, _SSHRecv and _SSHCloseSocket. It does support multiple simultaneous connections and aims to be pretty robust. Feel free to share your opinions Two of the included examples use a slightly modified version of Vintage Terminal by @Chimp Download The download includes ssh.au3 (UDF), plink.exe (necessary), vintage terminal and code examples: Version 1.0.1 - fixed rare _SSHConnect bug where "ssh-host-key prompt" was not answered SSH UDF 1.0.1.zip1 point -
Hi to all, I only am accustomed pas has posted on the forum (coz, I'm french). But I use it a lot. So first of all, thank you all to participate in the evolution of this wonderful product. Today is not one day like any other, I myself am decide has posted a UDF that I myself create and developed (there may be some bug) for some months. So here it is: This UDF allows to use the SSH protocol very easily in your code. It uses the syntax as the TCPxxx() function. Your code will be easier to convert :-). excused my English, I'm French. Example: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.4.0 Author: Joseph Barone 2010-2015 Script Function: Modele pour l'utilisation de la fonction ssh (plink). #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include #include #include #include #include #include "SSH_udf.au3" _SSHStartup() Global $butt[6] $Gui = GUICreate("SSH Console",550,400) $label1 = GUICtrlCreateLabel("Adresse IP:",10,10,150,20) ; ip $input1 = GUICtrlCreateInput("",10,25,150,20) ; ip $label2 = GUICtrlCreateLabel("Tcp port:",170,10,150,20) ; port $input2 = GUICtrlCreateInput("",170,25,60,20) ; port $label6 = GUICtrlCreateLabel("Protocol:",240,10,40,20) ; port $input6 = GUICtrlCreateInput("ssh",240,25,60,20) ; port $butt[0] = GUICtrlCreateButton("Connect0",310,5,80,20,$BS_DEFPUSHBUTTON) $butt[1] = GUICtrlCreateButton("Connect1",390,5,80,20) $butt[2] = GUICtrlCreateButton("Connect2",470,5,80,20) $butt[3] = GUICtrlCreateButton("Connect3",310,25,80,20) $butt[4] = GUICtrlCreateButton("Connect4",390,25,80,20) $butt[5] = GUICtrlCreateButton("Connect5",470,25,80,20) $Checkbox = GUICtrlCreateCheckbox("RSA, Fingerprint, Alert AutoValidate", 330, 45, 205, 25) $label4 = GUICtrlCreateLabel("Login:",10,45,150,20) ; login $input4 = GUICtrlCreateInput("",10,60,150,20) ; login $label5 = GUICtrlCreateLabel("Mot de passe:",170,45,150,20) ; password $input5 = GUICtrlCreateInput("",170,60,150,20,$ES_PASSWORD) ; password $label3 = GUICtrlCreateLabel("Commande a envoyer:",10,85,150,20) ; send command $input3 = GUICtrlCreateInput("",10,100,310,20) ; send commande vers l'hote $butt2 = GUICtrlCreateButton("Send",330,100,80,20,$BS_DEFPUSHBUTTON) GUICtrlSetState($butt2,$GUI_DISABLE) $edit = GUICtrlCreateEdit("",10,130,530,260,$WS_VSCROLL);,$WS_DISABLED)) GUISetState() Global $ConnectedSocket[6] = [-1,-1,-1,-1,-1,-1] Global $msg, $recv, $ret ; GUI Message Loop ;============================================== While 1 $nmsg = GUIGetMsg() If $nmsg = $GUI_EVENT_CLOSE Then ExitLoop ;;; connect part: $b = 0 While 1 If $nMsg = $butt[$b] Then If GUICtrlRead($butt[$b]) = "Connect"&$b Then _SSHParametreSet("yesall",GUICtrlRead($Checkbox)) _SSHParametreSet("protocol",GUICtrlRead($input6)) _SSHParametreSet("login",GUICtrlRead($input4)) _SSHParametreSet("passwd",GUICtrlRead($input5)) $ConnectedSocket[$b] = _SSHConnect(GUICtrlRead($input1),GUICtrlRead($input2)) If $ConnectedSocket[$b] = 0 Then MsgBox(0,"Erreur", "Impossible de ce connecter!!") Else GUICtrlSetData($butt[$b],"Close"&$b GUICtrlSetState($butt2,$GUI_ENABLE) EndIf DisplayArray($_config) ConsoleWrite("nb config:"&$_nbconf&@CRLF) Else _SSHCloseSocket($ConnectedSocket[$b]) GUICtrlSetData($butt[$b],"Connect"&$b GUICtrlSetState($butt2,$GUI_DISABLE) DisplayArray($_config) ConsoleWrite("nb config:"&$_nbconf&@CRLF) EndIf EndIf ;;; send part: If $nMsg = $butt2 Then $ret = _SSHSend( $ConnectedSocket[$b] , GUICtrlRead($input3)&@crlf) GUICtrlSetData($input3,"") GUICtrlSetState($input3,$GUI_FOCUS) EndIf ;;; receive part: $recv = _SSHRecv( $ConnectedSocket[$b]) If $recv <> "" Then GUICtrlSetData($edit, GUICtrlRead($edit) & $recv ) EndIf GUICtrlSendMsg($edit, $EM_SCROLL, $SB_PAGEDOWN, 0) $b += 1 If $b = UBound($butt) Then ExitLoop WEnd WEnd _SSHCloseSocket($ConnectedSocket) _SSHShutdown() Exit Func DisplayArray($array) $i = 0 $j = 0 if UBound($array,1) = 0 Then Return While 1 ConsoleWrite("(["&UBound($array,1)&"]["&UBound($array,2)&"]) ") While 1 ConsoleWrite("["&$j&"]"&$array[$i][$j]&" ") $j += 1 if UBound($array,2)<=$j Then ExitLoop WEnd ConsoleWrite(@CRLF) $i += 1 $j = 0 if UBound($array,1)<=$i Then ExitLoop WEnd EndFunc I join with UDF version of modified putty myself. 🙂 LoL but, it is not used with the UDF, it is included in the UDF. putty-04012015- 92453+lic.zip ssh_udf.zip New version (contains the latest version of plink (0.74) edited by http://jakub.kotrla.net/putty/) ssh_udf-v2.zip Same as the v2 but supports all putty/plink settings ssh_udf-v2.1.zip1 point
-
you need to hittest and check that the click is not on a checkbox #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiListView.au3> Opt('MustDeclareVars', 1) Local $msg Local $search_gui = GUICreate("Product Scanner", 400, 300, -1, -1) Local $listview = GUICtrlCreateListView("Product ID|Category|Last Update", 2, 2, 394, 250) _GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_BORDERSELECT, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUICtrlCreateListViewItem("1|2|3", $listview) GUICtrlCreateListViewItem("4|5|6", $listview) GUICtrlCreateListViewItem("7|8|9", $listview) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") If $iIDFrom = $listview Then Switch $iCode Case $NM_CLICK Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) If @error Then Return $GUI_RUNDEFMSG Local $Item = DllStructGetData($tInfo, "Index") If @error Or $Item = -1 Then Return $GUI_RUNDEFMSG Local $tTest = DllStructCreate($tagLVHITTESTINFO) DllStructSetData($tTest, "X", DllStructGetData($tInfo, "X")) DllStructSetData($tTest, "Y", DllStructGetData($tInfo, "Y")) Local $iRet = GUICtrlSendMsg($iIDFrom, $LVM_HITTEST, 0, DllStructGetPtr($tTest)) If @error Or $iRet = -1 Then Return $GUI_RUNDEFMSG Switch DllStructGetData($tTest, "Flags") Case $LVHT_ONITEMICON, $LVHT_ONITEMLABEL, $LVHT_ONITEM If _GUICtrlListView_GetItemChecked($listview, $Item) = False Then _GUICtrlListView_SetItemChecked($listview, $Item, 1) Else _GUICtrlListView_SetItemChecked($listview, $Item, 0) EndIf Case $LVHT_ONITEMSTATEICON ;on checkbox EndSwitch EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc1 point