Jump to content

therks

Active Members
  • Posts

    2,240
  • Joined

  • Last visited

  • Days Won

    3

therks last won the day on May 4 2020

therks had the most liked content!

About therks

  • Birthday 11/02/1982

Profile Information

  • Member Title
    Witty quote
  • Location
    BC, Canada
  • WWW
    therks.com

Recent Profile Visitors

1,111 profile views

therks's Achievements

Universalist

Universalist (7/7)

36

Reputation

  1. Thanks Melba. I wouldn't expect any promises, I get how fickle development can be.
  2. Is there a consensus on the Map variable type? Is it sticking around? I know the help file has the giant experimental feature warning, but it's been a thing for a while and I'm just wondering if there's been any more solid decisions made on whether it's staying or not. I've personally been avoiding it because I didn't want the rug pulled from under me when it gets deprecated. 😅
  3. Your comment made me curious, so I checked IF on command prompt: C:\Users\Therks\AppData\Local\Temp>IF EXIST File.txt ECHO 1 1 C:\Users\Therks\AppData\Local\Temp>IF EXIST "File.txt" ECHO 1 1 C:\Users\Therks\AppData\Local\Temp>IF EXIST "File.txt ECHO 1 The syntax of the command is incorrect. C:\Users\Therks\AppData\Local\Temp>IF EXIST File.txt" ECHO 1 The syntax of the command is incorrect. So that's expected. Then I got to thinking what other AutoIt functions are responding the same: ConsoleWrite(FileExists(@AutoItExe & '""""""') & @LF) ; Returns 1 ConsoleWrite(FileGetLongName(@AutoItExe & '""""""') & @LF) ; Returns C:\Program Files\AutoIt3\Beta\AutoIt3.exe"""""" ConsoleWrite(FileGetShortName(@AutoItExe & '""""""') & @LF) ; Returns C:\Program Files\AutoIt3\Beta\AutoIt3.exe"""""" ConsoleWrite(FileGetAttrib(@AutoItExe & '""""""') & @LF) ; Returns A ConsoleWrite(FileGetSize(@AutoItExe & '""""""') & @LF) ; Returns 946784 ConsoleWrite(FileGetTime(@AutoItExe & '""""""', 0, 1) & @LF) ; Returns 20210611084604 ConsoleWrite(FileGetVersion(@AutoItExe & '""""""') & @LF) ; Returns 0.0.0.0 (correct!) 😕
  4. For sure. Just wanted to verify it wasn't already a known issue or something. Bug ticket submitted: https://www.autoitscript.com/trac/autoit/ticket/3836
  5. Hi all, For some reason FileExists is treating paths that end with a quote mark (or multiple marks) as valid. Is this a bug? ; Assuming File.txt exists: ConsoleWrite(FileExists('File.txt')) ; Returns 1 ConsoleWrite(FileExists('"File.txt"')) ; Returns 0 ConsoleWrite(FileExists('"File.txt')) ; Returns 0 ConsoleWrite(FileExists('File.txt"')) ; Returns 1 ConsoleWrite(FileExists('File.txt""')) ; Returns 1 Cheers Bug ticket submitted: https://www.autoitscript.com/trac/autoit/ticket/3836
  6. This can't be the entire script obviously, cus this would just run and exit. Not sure why you're using DllOpen without using the open handle in anything, perhaps you misunderstand what that function is for? Anyway, I wrote this up: #include <Date.au3> #include <Misc.au3> #include <ScreenCapture.au3> Global $hUser32 = DllOpen('user32.dll') OnAutoItExitRegister(_Exit) While 1 If _IsPressed('2E', $hUser32) Then _ScreenCapture_Capture(@DesktopDir & "\" & StringRegExpReplace(_Now(), '[/ :]', '-') & ".jpg") Sleep(100) EndIf WEnd Func _Exit() DllClose($hUser32) EndFunc
  7. Well I figured out a method. Not quite the way I intended, but isn't that usually the way of AutoIt? 😁 So, I created this little script: If $CmdLine[0] Then For $i = 1 to $CmdLine[0] If @UserName = $CmdLine[$i] Then If Not Shutdown(4) Then MsgBox(0x10, @ScriptName & ' - Error', 'There was an error (#' & @error & ') trying to log off this user: ' & @UserName) EndIf Next Else MsgBox(0x40, @ScriptName, 'Will force log off if current user matches any name given as command parameters' &@CRLF&@CRLF& 'ie: ' & @ScriptName & ' "Aaron" "Bob Smith"' &@CRLF&@CRLF& 'Will log off Aaron or Bob Smith') EndIf And then I created a Scheduled Task triggered to run "On workstation lock of any user", gave it parameters of the kids' usernames, and Bob's your uncle. In my brief testing it seems to work alright.
  8. The issue with just shutting off the computer is sometimes we access it from other computers when we are not at home.
  9. Well PsLoggedOn is promising. However I'm not sure how to tell who the currently active user is (assuming I can get this to run from the SYSTEM account or somesuch), or how to log off other users (the logoff command doesn't seem to be available on Home either). Well there's only ever one active user, but often my brother or I will be logged on but disconnected. For example. In this example, I only want to sign out the user at the top. So I'm having some issues with your implementation: Win32_LoggedOnUser seems to list every user, logged on or not. How would I get the idle time (_Timer_GetIdleTime) for each user? How do I use Shutdown on another user? (Also wouldn't I just want $SD_LOGOFF+$SD_FORCE, because I don't want to restart the whole computer). Thanks for the input so far though guys. I'm going to edit my top post to clarify what I'm looking for.
  10. So I have no example code currently because I'm not sure where to even start. We're using the parental controls on the computer and the kids each have their own user profiles with limited time. The problem we're encountering is when their time runs out, or if they just hit Win+L and leave the computer, their games are still running in the background. I was hoping to write up a quick AutoIt script and throw it in a recurring scheduled task to just sign off any of the kid's profiles that's not currently active. I found some suggestions to use "query session" and then "logoff [user]" in the command line (which it seems I could easily automate with AutoIt) but that's only available on Win Pro and this system is running Home (and I even tried copying the query.exe from a Pro system but it errors out). Is there some AutoIt equivalent to the query and logoff functions or am I stuck? Edit: I'm adding some clarification to exactly what I'm hoping to get out of this script. I'd like to setup a scheduled task that runs outside of the current user (perhaps under the SYSTEM account?) in case NO user is currently active, that will detect which users are currently signed in. If users from a predefined list are not currently active, sign them off entirely. So let me give two examples: Example #1: - I am logged in, but not active (I left my browser open and locked the computer) - Nephew A is logged in, but not active (his time ran out while his game was running and the computer auto-locked) - Nephew B is logged in, and currently playing a game When script runs, ignore my profile (leave it signed in), log out Nephew A (closing his game), and ignore Nephew B because he's actively using the computer. Example #2: - I am logged in - Nephew A is logged in - Nephew B is logged in - No users are currently active (Windows is sitting on the choose user / sign in screen) When script runs, ignore my profile, log out Nephew A and Nephew B. I would perceive pseudo code, going as such: $aChildUsers = [ 'NephewA', 'NephewB' ] $aUserList = GetSignedInUsers() For $i = 0 to UBound($aUserList)-1 If Not UserIsActive($aUserList[$i]) Then For $j = 0 to UBound($aChildUsers)-1 If $aUserList[$i] = $aChildUsers[$j] Then LogOffUser($aUserList[$i]) Next EndIf Next Obviously, GetSignedInUsers(), UserIsActive(), LogOffUser() are not real functions. What I'm searching for is something of their equivalent. Thanks for your time!
  11. It might be worth putting a >0 check before the For loop, as GUIGetMsg pretty steadily returns values less than 1 for different GUI events ($GUI_EVENT_NONE, and $GUI_EVENT_MOUSEMOVE in particular come through pretty frequently). Unless you're already handling those events somewhere else in your switch statement, then it's going to be running through that For loop, looking for the control ID pretty often. Just something like this (modifying @Subz example): While 1 $iSel = GUIGetMsg() Switch $iSel Case $GUI_EVENT_CLOSE Exit Case Else If $iSel > 0 Then For $i = 0 To UBound($g_aButtons) - 1 If $iSel = $g_aButtons[$i][0] Then ;~ We send the array row number to MyFunc MyFunc($i) ExitLoop EndIf Next EndIf EndSwitch WEnd
  12. FuncName Ooh @mLipok beat me to it. 😁
  13. I've used it to swap which function is used in specific situations. For example this bit of code: Local $fClientPrompt = _ClientPromptWindow If IniRead($CONFIG_FILE, 'CLIENT', 'PROMPT', 'Buttons') = 'Menu' Then $fClientPrompt = _ClientPromptMenu EndIf $iChoice = $fClientPrompt($DEFAULT_ITEM, $APP_PATH)
  14. While I think there's a better way to do this using real arrays, have a look at the Assign and Eval functions. They should help you accomplish what you're doing.
  15. I'm an amateur with JavaScript objects myself, but I think this might be on the right track. <div id="map"></div> <script> class Model { constructor() { this.model = document.createElement("div"); } append(parent) { document.getElementById(parent).appendChild(this.model); } } var farm = new Model(); farm.append("map"); </script>
×
×
  • Create New...