Jump to content

legend

Active Members
  • Posts

    492
  • Joined

  • Last visited

Recent Profile Visitors

824 profile views

legend's Achievements

  1. I didn't knew that function, in that case, the code could be replaced with: #include <Timers.au3> while 1 sleep(5000) $iIdleTime = _Timer_GetIdleTime() if $iIdleTime > 4999 then $iIdleTime = "" ShellExecute("rundll32.exe", 'user32.dll,LockWorkStation') EndIf WEnd
  2. When I leave my desk, and forget to lock my pc, someone is often writing stuff on my pc... So here's a script that locks it after 5 seconds of inactivity, you can always increase it. #include <Misc.au3> Global $iIdleThreshold = 20000 ; 20 seconds in milliseconds While True Local $iLastInputTime = TimerInit() Local $bActivityDetected = False While TimerDiff($iLastInputTime) < $iIdleThreshold For $i = 0x01 To 0xFF If _IsPressed(Hex($i, 2)) Then $bActivityDetected = True ExitLoop EndIf Next ; Get initial mouse position $aInitialMousePos = MouseGetPos() ; Allow a small delay to detect mouse movement Sleep(50) ; Check for mouse movement $aCurrentMousePos = MouseGetPos() If $aInitialMousePos[0] <> $aCurrentMousePos[0] Or $aInitialMousePos[1] <> $aCurrentMousePos[1] Then $bActivityDetected = True ExitLoop EndIf Sleep(100) ; Adjust the sleep time as needed for better responsivenesds WEnd If $bActivityDetected Then ConsoleWrite("Keyboard or mouse activity detected." & @CRLF) Else ConsoleWrite("No keyboard or mouse activity detected." & @CRLF) ShellExecute("rundll32.exe", 'user32.dll,LockWorkStation') EndIf WEnd
  3. it's working great, how would I get the name of the selected item in the listview, when i right click, and selects one of the menus?
  4. #include <GuiMenu.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Enum $idOpen = 1000, $idSave, $idInfo Global $GUI, $listview, $hMenu _Main() Func _Main() ; Create GUI $GUI = GUICreate("Menu", 400, 300) $listview = GUICtrlCreateListView("test1|test2|test3|test4", 5, 5, 390, 290) GUICtrlCreateListViewItem("item1|item2|item3|item4", $listview) GUICtrlCreateListViewItem("test1|test2|test3|test4", $listview) $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo) ; Register message handlers GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $iIDFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iIDFrom Case $listview Switch $iCode Case $NM_CLICK, $NM_RCLICK $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) If DllStructGetData($tInfo, "Item") > -1 Then _GUICtrlMenu_TrackPopupMenu($hMenu, $GUI) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Switch $iwParam Case $idOpen _WinAPI_ShowMsg("Open") Case $idSave _WinAPI_ShowMsg("Save") Case $idInfo _WinAPI_ShowMsg("Info") EndSwitch EndFunc ;==>WM_COMMAND How can i make a submenu under one of the menu points when right clicking?
  5. #include <OutlookEX.au3> ;------------------------------------------------------------------------------------------------------------------------------------------------ ; Get/List all unread mails from the folder (R_Inbox) Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ;------------------------------------------------------------------------------------------------------------------------------------------------ $aItems = _OL_ItemFind($oOutlook, "*\", $olMail, "[UnRead]=True", "Subject", "test", "EntryID,Subject", "", 1) If IsArray($aItems) Then _ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemFind - Unread mails") Else MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Could not find an unread mail. @error = " & @error & ", @extended: " & @extended) EndIf ;_OL_Close($oOutlook) Local $numberOfUnRead = UBound($aItems, $UBOUND_ROWS) - 1 ; Gets the number of unread emails ; Get the mail headers of the first mail Global $sMailHeaders = _OL_ItemGet($oOutlook, $aItems[2][0]) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailheaderGet", "Error retrieving mail headers of mail with subject '" & $aItems[1][1] & "'. @error = " & @error & ", @extended: " & @extended) MsgBox(64, "OutlookEX UDF: _OL_MailheaderGet", "MAIL HEADERS WITH THE SUBJECT OF:" & @CRLF & "'" & $aItems[1][1] & "'." & @CRLF & @CRLF & $sMailHeaders) I can get the header / subject, but i'm not sure how I would actually get the body of the unread mails, does anybody know? :)
  6. I'm trying to get the full path of where the user is stored in active directory, like: domain.local/HR/Workers. The information is found in the field on the picture, when you click on the object tab, where i made a long black line to hide the text
  7. Is it possible to get the text from adopted name of object?
  8. How can I get the location of a user? Where the user object is stored in active directory
  9. I know this is a old thread, but maybe someone might be able to help. When you enter something in the list, and remove it again, it won't auto update. So it's like, you can't get back. Help would be much appreicated :)
  10. the value of pwdLastSet is 1601/01/01 00:00:00 If i type a wrong username, it fails, but if i try with a correct username, it just returns nothing, but doesen't fail. EDIT: i got it to work $aListProp = _AD_GetObjectProperties(@UserName, "pwdLastSet") msgbox(0,"", $aListProp[1][1])
  11. That solved the problem the Attribute: pwnLastSet gets updated to 1601/01/01 00:00:00 when you check : User must change password at next logon. However, I can't seem to grab the information, it returns nothing from the attribute: $pwdLastSet = _AD_GetObjectAttribute($input, "pwdLastSet") $pwdLastSet = _AD_GetObjectAttribute($input, "pwdLastSet")
  12. the value of @error is also 0, it doesen't seem likely it's a sync issue. the password for the user is still reset, and hasn't been changed, and the checkbox is enabled, but it still returns 0
  13. Global $result = _AD_IsPasswordExpired() MsgBox("","",$result) _AD_IsPasswordExpired seems to return 0 whenever the checkbox is enabled or not
×
×
  • Create New...