Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/10/2017 in all areas

  1. You can be sure that if something was created by Melba23 then it has all the features you'll ever need
    1 point
  2. zone97, The first thing to do is specify the minimum size of the GUI itself - search for $WM_GETMINMAXINFO to learn how to do that. Then you just need some simple maths when doing the column width calculation inside the $WM_SIZING handler. M23
    1 point
  3. zone97, Here you go: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> $Form1_1 = GUICreate("", 405, 325, -1, -1, $WS_SIZEBOX) GUISetBkColor(0xC0C0C0) $List1 = GUICtrlCreateListView("Call #|Number|Date|Length|Inbound|Missed", 7, 28, 390, 162, $LVS_SINGLESEL) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 50) $Button1 = GUICtrlCreateButton("Call Back", 160, 205, 85, 25) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER + $GUI_DOCKSIZE) $Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 154, 5, 97, 17) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKHCENTER + $GUI_DOCKSIZE) $Group1 = GUICtrlCreateGroup("This Month", 6, 198, 90, 97) $Label1 = GUICtrlCreateLabel("Inbound:", 15, 218, 43, 17) $Label2 = GUICtrlCreateLabel("Outbound:", 15, 243, 51, 17) $Label3 = GUICtrlCreateLabel("Missed:", 15, 268, 37, 17) $Label4 = GUICtrlCreateLabel("0", 69, 217, 20, 17) $Label5 = GUICtrlCreateLabel("0", 69, 242, 20, 17) $Label6 = GUICtrlCreateLabel("0", 69, 267, 20, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetResizing($Group1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT) GUICtrlSetResizing($Label1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT) GUICtrlSetResizing($Label2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT) GUICtrlSetResizing($Label3, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT) GUICtrlSetResizing($Label4, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT) GUICtrlSetResizing($Label5, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT) GUICtrlSetResizing($Label6, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT) $Group2 = GUICtrlCreateGroup("Today", 307, 198, 90, 97) $Label7 = GUICtrlCreateLabel("Inbound:", 316, 218, 43, 17) $Label8 = GUICtrlCreateLabel("Outbound:", 316, 243, 51, 17) $Label9 = GUICtrlCreateLabel("Missed:", 316, 268, 37, 17) $Label10 = GUICtrlCreateLabel("0", 370, 217, 20, 17) $Label11 = GUICtrlCreateLabel("0", 370, 242, 20, 17) $Label12 = GUICtrlCreateLabel("0", 370, 267, 20, 17) GUICtrlSetResizing($Group2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT) GUICtrlSetResizing($Label7, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT) GUICtrlSetResizing($Label8, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT) GUICtrlSetResizing($Label9, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT) GUICtrlSetResizing($Label10, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT) GUICtrlSetResizing($Label11, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT) GUICtrlSetResizing($Label12, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SIZING, "_WM_SIZING") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZING($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam If $hWnd = $Form1_1 Then $aRet = ControlGetPos($Form1_1, "", $List1) _GUICtrlListView_SetColumnWidth($List1, 1, $aRet[2] - 340) EndIf EndFunc Please ask if you have any questions. M23
    1 point
  4. dexto

    A Non-Strict JSON UDF (JSMN)

    Implementation of the JSMN using Map available in Autoit Beta (3.3.15): #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "jsonMap.au3" $json = '{"test":"yay"}' $test = Json_Decode($json) ConsoleWrite($test['test'] & @CRLF) $test['test'] = 'horray!!!' ConsoleWrite($test['test'] & @CRLF) ConsoleWrite(Json_Encode($test) & @CRLF) jsonMap.au3
    1 point
  5. water

    UnixTime Stamp to Date/Time

    Using the search feature of the forum would have returned some hits. One of them:
    1 point
  6. Look at _DateAdd function : #Include <Date.au3> Local $date = _DateAdd('s', 1486570334, "1970/01/01 00:00:00") Local $longdate = _DateTimeFormat($date, 1) & " " & _DateTimeFormat($date, 5) ConsoleWrite($longdate)
    1 point
  7. Tjalve, First, let us deal with handles and ControlIDs. Windows handles are unique identifiers that the OS uses to keep track of everything on the system, such as GUIs and controls, which continually send messages around the system so that everything in the system knows what is going on (which GUI is active, which control has just been actioned, which key was pressed, etc, etc). These messages contain all sorts of data, but essentially explain "which control has just done what". AutoIt tries to make life simple for you by using ControlIDs to identify its native controls - theses IDs are actually the indIces of an internal array of all controls maintained by AutoIt. So when you look for these ControlIDs in a GUIGetMsg loop you are asking AutoIt to access the Windows message stream and pick put those messages which refer to that control - the OnEvent commands work in a similar manner. Now to how the script I posted works. As the UDF functions return handles and not ControlIDs (which as explained above are only returned by AutoIt native functions) we cannot use a GUIGetMsg loop to look for messages, so we have to do it ourselves rather than relying on AutoIt to do it for us. This is where the GUIRegisterMsg command comes into play - it peeks into the Windows message stream and lets us see what is happening. In the script above we are asking to look at WM_NOTIFY messages - a pretty comprehensive set which, amongst many other things, covers selecting items in a TreeView. When a WM_NOTIFY message is detected in the stream AutoIt then runs the allocated function or "handler" where we can examine the message in detail: We create a data structure to look at the detailed content of the message - this data is stored by Windows and we use one of the message parameters ($lParam) to access it. We then check that this message was indeed sent by the treeview by looking inside the data structure - we can ignore the vast majority of messages which have been sent by other controls. Finally we check if the message deals with a change of the selected item in the treeview - and if it does than we know that we have found the message we were looking for. And there you have it - because the treeview was created by a UDF and not by an internal AutoIt function, we had to recreate what AutoIt does for us "under the hood" and peer into the Windows message stream ourselves to intercept the message telling us that the user had selected another item in the treeview. You can see the same thing happening with tab controls if you read the Tabs tutorial in the Wiki - if you create the tab with the UDF you need to do a lot more work to make it work correctly. I hope that the above explanation makes you realise how much AutoIt does for you behind the scenes - please ask again if anything is still unclear. M23
    1 point
  8. Decipher

    Array Slice UDF

    _ArraySlice() its similar to list[n:n] in Python. I was converting a python script to autoit and was bored afterwords so I decided to create this UDF. #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArraySlice ; Description ...: Returns the specified elements as a zero based array. ; Syntax.........: _ArraySlice(Const ByRef $avArray[, $iStart = 0[, $iEnd = 0[, $iStep = 1]]]) ; Parameters ....: $avArray - Array to Slice ; $iStart - [optional] Index of array to start slicing ; $iEnd - [optional] Index of array to stop slicing ; $iStep - [optional] Increment can be negative ; Return values .: Success - Array containing the specified portion or slices of the original. ; Failure - "", sets @error: ; |1 - $avArray is not an array ; |2 - $iStart is greater than $iEnd when increment is positive ; |3 - $avArray is not an 1 dimensional array ; |4 - $iStep is greater than the array ; Author ........: Decipher ; Modified.......: ; Remarks .......: ; Related .......: StringSplit, _ArrayToClip, _ArrayToString ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== #include <Array.au3> ; Needed for _ArrayDisplay only. Example() Func Example() Local $MyArray[10] $MyArray[0] = 9 $MyArray[1] = "One" $MyArray[2] = "Two" $MyArray[3] = "Three" $MyArray[4] = "Four" $MyArray[5] = "Five" $MyArray[6] = "Six" $MyArray[7] = "Seven" $MyArray[8] = "Eight" $MyArray[9] = "Nine" Local $MyNewArray = _ArraySlice($MyArray, 9, 0, -2) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1, 5) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 5) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1, 3, 1) _ArrayDisplay($MyNewArray) EndFunc ;==>Example Func _ArraySlice(Const ByRef $avArray, $iStart = 0, $iEnd = 0, $iStep = 1) If Not IsArray($avArray) Then Return SetError(1, 0, 0) If UBound($avArray, 0) <> 1 Then Return SetError(3, 0, "") Local $iNew = 0, $iUBound = UBound($avArray) - 1 ; Bounds checking If $iStep > $iUBound Then Return SetError(4, 0, "") If $iEnd < 0 Or $iEnd > $iUBound Or $iEnd <= 0 And $iStep > 0 Then $iEnd = $iUBound If $iStart < 0 Then $iStart = 0 If $iStart > $iEnd And $iStep >= 1 Then Return SetError(2, 0, "") Local $aNewArray[$iUBound] For $i = $iStart To $iEnd Step $iStep ; Create a new zero based array $aNewArray[$iNew] = $avArray[$i] $iNew +=1 Next ReDim $aNewArray[$iNew] Return $aNewArray EndFunc ;==>_ArraySlice_ArraySlice.au3
    1 point
  9. XP and Win7 64 ok too
    1 point
  10. I've added volume control and updated the OP. Tested only on win 10.
    1 point
  11. Here's one to chew on SafeMode WMI can provide most of the rest of the info you want. Scriptomatic https://www.windows-commandline.com/get-computer-model/
    1 point
  12. You can use: RegRead('HKLM\Software\Microsoft\Windows NT\CurrentVersion', 'ReleaseId')
    1 point
  13. A20017, Just check which ListBox has focus: While 1 If _IsPressed("2E", $dll) Then ; Wait for key to be released to avoid multiple firing the code below While _IsPressed("2E", $dll) Sleep(10) WEnd ; Detect focused ListBox Switch _WinAPI_GetFocus() Case $hListBoxGlobal $indice = _GUICtrlListBox_GetCurSel($hListBoxGlobal) _GUICtrlListBox_DeleteString($hListBoxGlobal, $indice) Case $hListBoxMain $indice = _GUICtrlListBox_GetCurSel($hListBoxMain) _GUICtrlListBox_DeleteString($hListBoxMain, $indice) Case $hListBoxMini $indice = _GUICtrlListBox_GetCurSel($hListBoxMini) _GUICtrlListBox_DeleteString($hListBoxMini, $indice) EndSwitch EndIf WEnd Good enough? M23
    1 point
  14. An other way... #include <Date.au3> $epoch = 1444077951 $aCall = DllCall("msvcrt.dll", "str:cdecl", "ctime", "int*", $epoch) $tmp = StringSplit($aCall[0], " ") For $i = 1 to 12 If $tmp[2] = _DateToMonth($i, $DMW_SHORTNAME) Then $tmp[2] = $i Next $date = StringFormat("%4i/%02i/%02i %8s", $tmp[5], $tmp[2], $tmp[3], $tmp[4]) msgbox(0,"", $date)
    1 point
  15. #include <Date.au3> Global $Result = _GetHumanTimeFromUNIX("1444077951") MsgBox(0, "", $Result) Func _GetHumanTimeFromUNIX($UnixTime) Local $Seconds = $UnixTime + _GetCurrentGMTDiff() * 3600 Return _DateAdd("s", $Seconds, "1970/01/01 00:00:00") EndFunc Func _GetCurrentGMTDiff() Local $Struct = DllStructCreate("struct;long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias;endstruct") Local $Result = DllCall("kernel32.dll", "dword", "GetTimeZoneInformation", "struct*", $Struct) If @error Or $Result[0] = -1 Then Return SetError(@error, @extended, 0) Return $Result[0] EndFunc
    1 point
  16. guinness

    ...

    I found this topic: #500084 and had a go at eliminating _StringBetween() and instead opting for StringRegExp(). Based on the idea by wakillon. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetIP_Country ; Description ...: Retrieve details about the country of origin for an IP address. ; Syntax ........: _GetIP_Country() ; Parameters ....: Success - An array contain details: ; $aArray[0] - IP address ; $aArray[1] - ISP ; $aArray[2] - Region ; $aArray[3] - Country code ; Failuer - Returns 0 and sets @error to non-zero. ; Return values .: None ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _GetIP_Country() Local $aSRE = StringRegExp(BinaryToString(InetRead('http://xml.utrace.de/?query=' & _GetIP())), _ '<ip>([\d.]{7,15})</ip>\n' & _ '<host>[^>]*</host>\n' & _ '<isp>([^>]+)</isp>\n' & _ '<org>[^>]+</org>\n' & _ '<region>([^>]+)</region>\n' & _ '<countrycode>([^>]+)</countrycode>\n', 3) If @error Then Return SetError(@error, 0, 0) Return $aSRE EndFunc ;==>_GetIP_CountryExample use of Function: #include <Array.au3> ; Not Required, Only Needed For _ArrayDisplay() #include <Inet.au3> Local $aCountry = _GetIP_Country() _ArrayDisplay($aCountry)
    1 point
  17. Does this work? https://www.autoitscript.com/wiki/Snippets_(_Windows_OS_)#IsSafeMode.28.29
    1 point
  18. If I HotKeySet("E") it will disable the hotkey. Thank you.
    1 point
×
×
  • Create New...