Leaderboard
Popular Content
Showing content with the highest reputation on 12/10/2018 in all areas
-
IMDb Top 250 extracter
FrancescoDiMuro reacted to JLogan3o13 for a topic
@stefionesco While your project seems fairly innocuous, it has been pointed out that IMDB's Conditions of Use page states very clearly: As I am guessing that you do not possess this in writing, I am locking this thread based on our forum rules. Please read these and familiarize yourself before posting again.1 point -
1D to 2D Array Issues
FrancescoDiMuro reacted to mikell for a topic
Wow I forgot to mention this ! It should not be a little suggestion, it should be a heavy one1 point -
1D to 2D Array Issues
Fractured reacted to FrancescoDiMuro for a topic
Hi @Fractured A little suggestion: don't declare Global variables in Functions, since they are automatically declared as Local. And, as @mikell said, if you could post a sample string of $sResult variable...1 point -
It could be of great help to post the "$sResult" string ... What about something like this ? Func _ShowArray($sResult) Local $srString = StringReplace($sResult, @CRLF&@CRLF, @CRLF) $srString = StringReplace($srString, ":", "|") Local $aResult2d[0][2] _ArrayAdd($aResult2d, $srString) _ArrayDisplay($aResult2d) EndFunc ;==>_ShowArray1 point
-
API requests in autoit
FrancescoDiMuro reacted to JLogan3o13 for a topic
As this thread is walking the line between legitimate and not, it is locked temporarily while the Moderating team review.1 point -
Having Problem on send keys. - (Locked)
FrancescoDiMuro reacted to JLogan3o13 for a topic
Not sure what that rambling mess above is supposed to mean, but you seem to have walked right past the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. The Moderation team1 point -
_GUICtrlListView_SetItem's $iParam parameter
pixelsearch reacted to LarsJ for a topic
When you add listview items with the native GUICtrlCreateListViewItem() the controlID (an integer in the range 3 - 65,535) is stored in ItemParam. When you add listview items with _GUICtrlListView_-functions (UDF-functions) ItemParam is not used. You can use it to store your own information. If you are adding listview items with GUICtrlCreateListViewItem(), you cannot use ItemParam for your own information. It's already used for controlID. What information do you store in ItemParam in your example? What are you using the information for? If you do not need to store additional information, then there is no need to fill out ItemParam. Just leave it as default zero. Offset of 1000 (or maybe 100,000 or maybe negative ItemParam values (If you are using negative ItemParam values use an offset of -20 to avoid conflicts with $GUI_EVENT_-constants.)) comes into play only if there is actually a need to save additional information in ItemParam. In the example for _GUICtrlListView_AddItem(), there is no need to save additional information in ItemParam. Therefore, the value is not filled out and there is no need for any offset. Native, built-in or internal functions are the functions stored in AutoIt3.exe and AutoIt3_x64.exe and coded in C++. Therefore, they are significantly faster than UDF functions.1 point -
hi @Malkey, I've simplified your function a bit ; Function ------------ _Date_GetFirst_LastOfPreviousMonth ----------------- ; Only parameter - Date in the format is "YYYY/MM/DD" ; Returns an Array - First element - Array[0] - Start date of previous month in the format of "MM/DD/YYYY". ; - Second element - Array[1] - Last date of previous month in the format of "MM/DD/YYYY". Func _Date_GetFirst_LastOfPreviousMonth($iThisMonth) If Not _DateIsValid($iThisMonth) Then Return SetError(1, 0, "") Local $aDate = StringSplit(_DateAdd('M', -1, $iThisMonth), '/', 2) Local $sYM = $aDate[0] & '/' & $aDate[1] & '/' Local $aRetArray = [$sYM & "01", $sYM & _DateDaysInMonth($aDate[0], $aDate[1])] Return $aRetArray EndFunc ;==>_Date_GetFirst_LastOfPreviousMonth1 point
-
I was needing to enable and disable a network connection. I google and find a good C++ example using interfaces. so I ported to Autoit (ObjCreateInterface ) Global Const $NCME_DEFAULT = 0 Global Const $S_OK = 0 Global Const $sCLSID_ConnectionManager = '{BA126AD1-2166-11D1-B1D0-00805FC1270E}' Global Const $sIID_INetConnectionManager = '{C08956A2-1CD3-11D1-B1C5-00805FC1270E}' Global Const $sIID_IEnumNetConnection = '{C08956A0-1CD3-11D1-B1C5-00805FC1270E}' Global Const $sIID_INetConnection = '{C08956A1-1CD3-11D1-B1C5-00805FC1270E}' Global Const $sINetConnectionManager = "EnumConnections hresult(int;ptr*)" Global Const $sTag_IEnumNetConnection = "Next hresult(int;ptr*;ulong*)" Global Const $sTag_INetConnection = "Connect hresult();Disconnect hresult();Delete hresult();Duplicate hresult(wstr;ptr*);GetProperties hresult(ptr)" Global Const $sTag_NETCON_PROPERTIES = "byte guidId[16];ptr pszwName;ptr pszwDeviceName;dword Status;dword MediaType;dword dwCharacter;byte clsidThisObject[16];byte clsidUiObject[16]" Func NetWorkEnableDisable($sNetWorkName, $bEnable_Disable = true) Local $hResult = 0 Local $iCount = 0 Local $pIEnumNetConnection = 0 Local $oIEnumNetConnection = 0 Local $pConnection = 0 Local $tNETCON_PROPERTIES = 0 Local $tName = 0 Local $sNetName = "" Local $tDeviceName = 0 Local $oConnection = 0 Local $pPROPERTIES = 0 Local $tPtr = 0 Local $iState=0 Local $oNetCManager = ObjCreateInterface($sCLSID_ConnectionManager, $sIID_INetConnectionManager, $sINetConnectionManager) If IsObj($oNetCManager) Then ConsoleWrite("$oNetCManager:" & IsObj($oNetCManager) & @CRLF) $oNetCManager.EnumConnections($NCME_DEFAULT, $pIEnumNetConnection) If $pIEnumNetConnection Then ConsoleWrite("$pIEnumNetConnection: " & $pIEnumNetConnection & @CRLF) $oIEnumNetConnection = ObjCreateInterface($pIEnumNetConnection, $sIID_IEnumNetConnection, $sTag_IEnumNetConnection) If IsObj($oIEnumNetConnection) Then ConsoleWrite("$oIEnumNetConnection: " & IsObj($oIEnumNetConnection) & @CRLF) While ($oIEnumNetConnection.Next(1, $pConnection, $iCount) = $S_OK) ConsoleWrite("$pConnection: " & $pConnection & " $iCount: " & $iCount & @CRLF) $oConnection = ObjCreateInterface($pConnection, $sIID_INetConnection, $sTag_INetConnection) If IsObj($oConnection) Then $tNETCON_PROPERTIES = DllStructCreate($sTag_NETCON_PROPERTIES) $tPtr = DllStructCreate("ptr Pointer") ConsoleWrite("$oConnection: " & IsObj($oConnection) & @CRLF) $hResult = $oConnection.GetProperties(DllStructGetPtr($tPtr)) If SUCCEEDED($hResult) Then $tNETCON_PROPERTIES = DllStructCreate($sTag_NETCON_PROPERTIES, $tPtr.Pointer) $tName = DllStructCreate("wchar[260]", $tNETCON_PROPERTIES.pszwName) $sNetName = DllStructGetData($tName, 1) If $bEnable_Disable Then If $sNetName = $sNetWorkName Then If SUCCEEDED($oConnection.Connect()) Then DllCall("netshell.dll", "none", "NcFreeNetconProperties", "ptr", DllStructGetPtr($tNETCON_PROPERTIES)) Return True EndIf EndIf Else If $sNetName = $sNetWorkName Then If SUCCEEDED($oConnection.Disconnect()) Then DllCall("netshell.dll", "none", "NcFreeNetconProperties", "ptr", DllStructGetPtr($tNETCON_PROPERTIES)) Return True EndIf EndIf EndIf DllCall("netshell.dll", "none", "NcFreeNetconProperties", "ptr", DllStructGetPtr($tNETCON_PROPERTIES)) $tPtr = 0 $tName = 0 $tNETCON_PROPERTIES = 0 $oConnection = 0 Else Return False EndIf Else Return False EndIf WEnd Else Return False EndIf Else Return False EndIf Else Return False EndIf EndFunc ;==>NetWorkEnableDisable Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED Saludos1 point
-
Try this: #include <Array.au3> $sHost = @ComputerName $aNetworkAdapters = WMI_ListAllNetworkAdapters($sHost) _ArrayDisplay($aNetworkAdapters) Func WMI_ListAllNetworkAdapters($sHost) ;coded by UEZ 2013 Local $objWMIService = ObjGet("winmgmts:\\" & $sHost & "\root\cimv2") If @error Then Return SetError(1, 0, 0) Local $aStatus[13] = ["Disconnected", "Connecting", "Connected", "Disconnecting", "Hardware not present", "Hardware disabled", "Hardware malfunction", _ "Media Disconnected", "Authenticating", "Authentication Succeeded", "Authentication Failed", "Invalid Address", "Credentials Required"] $colItems = $objWMIService.ExecQuery("SELECT Name, NetConnectionID, NetConnectionStatus FROM Win32_NetworkAdapter", "WQL", 0x30) Local $aNetworkAdapters[1000][3], $i = 0, $iPointer If IsObj($colItems) Then For $objItem in $colItems With $objItem $aNetworkAdapters[$i][0] = .NetConnectionID $aNetworkAdapters[$i][1] = .Name $aNetworkAdapters[$i][2] = $aStatus[.NetConnectionStatus * 1] EndWith $i += 1 Next ReDim $aNetworkAdapters[$i][3] Return $aNetworkAdapters Else Return SetError(2, 0, 0) EndIf EndFunc Br, UEZ1 point
-
Right click on ListView
GoogleDude reacted to Tvern for a topic
You can use this as a basis for experimentation. You might want to switch to a UDF listview if you're going to rely on more UDF functions though. #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> ;basic GUI Global $GUI = GUICreate("", 300, 450) Global $hListView = GUICtrlCreateListView("A|B|C|D|E|F|G", 25, 25, 250, 400) For $i = 0 To 20 GUICtrlCreateListViewItem("A" & $i & "|B" & $i & "|C" & $i & "|D" & $i & "|E" & $i & "|F" & $i & "|G" & $i, $hListView) Next ;Context Menu Global $hCMenu = GUICtrlCreateContextMenu($hListView) ;add a context menu to the listview. I don't think you can add a seperate one to each item unless you write your own function. Global $hCMenuText = GUICtrlCreateMenuItem("Get Text", $hCMenu) ;add the get text option to the menu. Global $sItemText ;this will store the text of the last right-clicked item. GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ;This intercepts the Notification windows sends your GUI when you right click the listview (and many others) amd sends it to the "WM_NOTIFY" function. GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $hCMenuText _ShowText() EndSwitch WEnd ;All Notify messages for your GUI will be send to this function. Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) ;$ilParam is a pointer. This reads what's at that adress. (not sure why the name suggests its an int) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom ;Check what control triggered the msg Case $hWndListView ;If it was the listview... Switch $iCode ;Check what action triggered the msg Case $NM_RCLICK ;If it was a right click... $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ;get the information about the item clicked. $sItemText = _GUICtrlListView_GetItemText($hWndListView, DllStructGetData($tInfo, "Index"), DllStructGetData($tInfo, "SubItem")) ;store the item text in a global variable in case the get text option is clicked. ;You could also just store the Index and SubItem values, the entire $tInfo struct, or whatever works best for you. ;Uncomment the next part to get more information about your click. ;~ _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ ;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ ;~ "-->Code:" & @TAB & $iCode & @LF & _ ;~ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ ;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ ;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ ;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ ;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ ;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ ;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ ;~ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _ ;~ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) EndSwitch EndSwitch ;Returning this allows the GUI to handle the messages in the usual way once you're done. Returning anything else will block default behavior. (giving you a largely unresponsive GUI) Return $GUI_RUNDEFMSG EndFunc Func _ShowText() MsgBox(0,"Test",$sItemText) EndFunc Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc1 point -
You have problems with this because nor all constants are being declared in Excel.au3 UDF Here is a list of all Excel constants, I've saved in a csv format from a bigger sheet with all Office constants. What you have to do is, declare missing constants at the top of your script and you should be fine. Just rename the file as Constants.csv (couldn't attach *csv files so I had to rename it). Constants.txt You can try this code (re-worked your code a bit) - I couldn't find the value of xlPrintErrorsDisplayed so I took that out of your code. #include <Excel.au3> $xlPrintNoComments = -4142 $xlPortrait = 1 $xlPaperLetter = 1 $xlDownThenOver = 1 $oExcel = _ExcelBookNew() With $oExcel.ActiveSheet.PageSetup .PrintTitleRows = "$1:$1" .PrintTitleColumns = "" .PrintArea = "" .LeftHeader = "&D" .CenterHeader = "Test Report" .RightHeader = "&P of &N" .LeftFooter = "&F {&A}" .CenterFooter = "" .RightFooter = "" .LeftMargin = $oExcel.Application.InchesToPoints(0.25) .RightMargin = $oExcel.Application.InchesToPoints(0.25) .TopMargin = $oExcel.Application.InchesToPoints(0.75) .BottomMargin = $oExcel.Application.InchesToPoints(0.75) .HeaderMargin = $oExcel.Application.InchesToPoints(0.5) .FooterMargin = $oExcel.Application.InchesToPoints(0.5) .PrintHeadings = False .PrintGridlines = False .PrintComments = $xlPrintNoComments .CenterHorizontally = False .CenterVertically = False .Orientation = $xlPortrait .Draft = False .PaperSize = $xlPaperLetter .FirstPageNumber = $xlAutomatic .Order = $xlDownThenOver .BlackAndWhite = False .Zoom = 100 EndWith Sleep(20000) _ExcelBookClose($oExcel)1 point