-
Posts
492 -
Joined
-
Last visited
legend's Achievements
-
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
-
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
-
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?
-
#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?
-
OutlookEX - Find unread mails and get the body
legend replied to legend's topic in AutoIt General Help and Support
solved, just had to add subject, body -
#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? :)
-
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
-
-
How can I get the location of a user? Where the user object is stored in active directory
-
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 :)
-
Active Directory UDF - Help & Support (III)
legend replied to water's topic in AutoIt General Help and Support
- 875 replies
-
- active directory
- ad
-
(and 2 more)
Tagged with:
-
Active Directory UDF - Help & Support (III)
legend replied to water's topic in AutoIt General Help and Support
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])- 875 replies
-
- active directory
- ad
-
(and 2 more)
Tagged with:
-
Active Directory UDF - Help & Support (III)
legend replied to water's topic in AutoIt General Help and Support
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")- 875 replies
-
- active directory
- ad
-
(and 2 more)
Tagged with:
-
Active Directory UDF - Help & Support (III)
legend replied to water's topic in AutoIt General Help and Support
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- 875 replies
-
- active directory
- ad
-
(and 2 more)
Tagged with:
-
Active Directory UDF - Help & Support (III)
legend replied to water's topic in AutoIt General Help and Support
Global $result = _AD_IsPasswordExpired() MsgBox("","",$result) _AD_IsPasswordExpired seems to return 0 whenever the checkbox is enabled or not- 875 replies
-
- active directory
- ad
-
(and 2 more)
Tagged with: