Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/08/2022 in all areas

  1. Why $bForceFunc is needed in some cases is described in the Wiki.
    1 point
  2. Subz

    Get and Set Icon position.

    An example of capturing and moving a shortcuts position: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GuiListView.au3> #include <Array.au3> Global $g_sSearch = "HP Support Assistant" ;~ Show all shortcut positions Global $aShortcutIcon = _GetShortcutPos() If Not @error Then _ArrayDisplay($aShortcutIcon) ;~ Example for searching and moving "HP Support Assistant" shortcut position Global $aShortcutIcon = _GetShortcutPos($g_sSearch) If Not @error Then _ArrayDisplay($aShortcutIcon) ;~ Move the "HP Support Assistant" shortcut to a new position _SetShortcutPos($g_sSearch, 500, 100) MsgBox(4096, "Check New Position", "Check " & $g_sSearch & " position has moved") ;~ Move the "HP Support Assistant" shortcut back to it's original position _SetShortcutPos("HP Support Assistant", $aShortcutIcon[0][1], $aShortcutIcon[0][2]) Func _SetShortcutPos($_sShortcutName = "", $_iXPos = 0, $_iYPos = 0) If $_sShortcutName = "" Then Return ;~ Desktop handle Local $hDesktopListview = ControlGetHandle("[CLASS:Progman]", "", "[CLASS:SysListView32;INSTANCE:1]") If @error Then Exit Local $iShortcutPos = _GUICtrlListView_FindInText($hDesktopListview, $_sShortcutName) _GUICtrlListView_SetItemPosition($hDesktopListview, $iShortcutPos, $_iXPos, $_iYPos) EndFunc Func _GetShortcutPos($_sShortcutName = "") Local $sShortcutName Local $bShortcut = $_sShortcutName = "" ? False : True ;~ Desktop handle Local $hDesktopListview = ControlGetHandle("[CLASS:Progman]", "", "[CLASS:SysListView32;INSTANCE:1]") If @error Then Return SetError(1, 0) ;~ Desktop shortcut count Local $iShortcutCount = _GUICtrlListView_GetItemCount($hDesktopListview) If $iShortcutCount > 0 Then Local $aShortcutPos[$iShortcutCount][3] For $i = 0 To UBound($aShortcutPos, 1) - 1 If $bShortcut Then Dim $aShortcutPos[0][3] $sShortcutName = _GUICtrlListView_GetItemText($hDesktopListview, $i) If $sShortcutName = $_sShortcutName Then Dim $aShortcutPos[1][3] $aShortcutPos[0][0] = $sShortcutName $aShortcutPos[0][1] = _GUICtrlListView_GetItemPositionX($hDesktopListview, $i) $aShortcutPos[0][2] = _GUICtrlListView_GetItemPositionY($hDesktopListview, $i) Return SetError((UBound($aShortcutPos) > 0 ? 0 : 1), 0, $aShortcutPos) EndIf Else $aShortcutPos[$i][0] = _GUICtrlListView_GetItemText($hDesktopListview, $i) $aShortcutPos[$i][1] = _GUICtrlListView_GetItemPositionX($hDesktopListview, $i) $aShortcutPos[$i][2] = _GUICtrlListView_GetItemPositionY($hDesktopListview, $i) EndIf Next Else Return SetError(1, 0) EndIf Return SetError((UBound($aShortcutPos) > 0 ? 0 : 1), 0, $aShortcutPos) EndFunc
    1 point
  3. Nine

    Get and Set Icon position.

    Desktop is a ListView (SysListView321) of shortcuts. You can use ControlListView and ListView UDF to interact with it. Only catch is you need to run x64 if you comp is 64 bits.
    1 point
  4. CodeWriter

    SMTP Mailer UDF

    The AutoHotKey community has been working on this topic ( https://www.autohotkey.com/boards/viewtopic.php?f=76&t=102434) and I have confirmed that their workaround works: 1. Turn on 2-step authentication for Google (using phone text/call, fob, backup code, etc depending on your preferences) on their Security page 2. Go back to Google Security page and select the option that now appears: "App Passwords" to generate a "mail" unique Google specific 16-character password 3. Use that generated password in the call to _INetSmtpMailCom() instead of your Gmail account password. Hope that helps anyone in the same bind.
    1 point
  5. You actually overwrite the values of $Drive_Array when you use GuiCtrlCreateCheckBox, here is how I'd do it, although there are otherways: Create 2d Array for $Drives_Array Global $Drives_Array = IniReadSectionNames("config.ini") ;~ Add Array Column ControlId _ArrayColInsert($Drives_Array, 0) ;~ Add Array Column Name _ArrayColInsert($Drives_Array, 2) For $i = 1 to UBound($Drives_Array) - 1 ;~ $Drives_Array[$i][0] = ControlId ;~ $Drives_Array[$i][1] = Drive example H: ;~ $Drives_Array[$i][2] = Drive Name $Drives_Array[$i][2] = IniRead("config.ini", $Drives_Array[$i][1], "Name", "Default Value") $Drives_Array[$i][0] = GUICtrlCreateCheckbox($Drives_Array[$i][2], 0, ($i * 35), 140, 30) GUICtrlSetFont($Drives_Array[$i][0], 20, 0, 0, "Calibri") GUICtrlSetColor($Drives_Array[$i][0], 0x225588) If IniRead("saveddrives.ini", "Drives", $Drives_Array[$i][1], "Default Value") == "Connect" Then GUICtrlSetState($Drives_Array[$i][0], $GUI_CHECKED) EndIf Next You can then save using the following function: Func Save_Drives() FileDelete("saveddrives.ini") ;~ Loop through GuiControlCreateCheckBox ControlIds For $i = 1 To UBound($Drives_Array)-1 If GUICtrlRead($Drives_Array[$i][0]) = $GUI_CHECKED Then IniWrite("saveddrives.ini", "Drives", $Drives_Array[$i][1], "Connect") Else IniWrite("saveddrives.ini", "Drives", $Drives_Array[$i][1], "Disconnect") EndIf Next EndFunc
    1 point
  6. just for future reference for those that want to be able to switch between read only and editable edit control #include <guiconstants.au3> Opt("GUIOnEventMode", 1) Dim $ReadOnly = True $Main = GUICreate('', 200, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "close") $tab1_label = GUICtrlCreateEdit(" App Label ", 20, 20, 160, 26, $SS_LEFT) GUICtrlSendMsg($tab1_label, $EM_SETREADONLY, $ReadOnly, 0) GUICtrlSetFont(-1, 14) GUICtrlSetBkColor($tab1_label, 0x316AC5) GUICtrlSetColor($tab1_label, 0xFFFFFF) GUISetCursor(5, 1, $Main) ; standard arrow to keep IBEAM cursor from showing up GUICtrlCreateButton("Toggle", 20, 50, 90, 25) GUICtrlSetOnEvent(-1, "_Toggle") GUISetState() While 1 Sleep(500) WEnd Func _Toggle() $ReadOnly = Not $ReadOnly GUICtrlSendMsg($tab1_label, $EM_SETREADONLY, $ReadOnly, 0) EndFunc ;==>_Toggle Func close() Exit EndFunc ;==>close
    1 point
×
×
  • Create New...