Jump to content

timmy2

Active Members
  • Posts

    249
  • Joined

  • Last visited

Profile Information

  • Location
    USA

Recent Profile Visitors

550 profile views

timmy2's Achievements

  1. Thank @careca and @Nine. I experimented with your much appreciated suggestions but ended up simply creating two users profiles -- one for English users and one for Spanish.
  2. In case you can't find SciTEUser.properties here's the path: "C:\Users\(username)\AppData\Local\AutoIt v3\SciTE\SciTEUser.properties"
  3. @Nessie, won't run on Windows 10 Pro 64b.
  4. I apologize for being unclear, but thank you for replying, @BrewManNH. I want to run an AutoIt script that will do some housekeeping and then log out the user. But I don't want to do that -- especially logging him out -- if he's still "using" the computer. Microsoft's version of "idle" is more complete since it takes into account user activity as well as CPU and HDD activity. I was wondering if AutoIt was tapping into the same Idle, but it turns out it's using a different source that solely user activity.
  5. To change the language used by Windows GUI and the browser (Chrome in my case), the only method I've found that works is to go to Settings > Time & Language > Language > Preferred Language, switch the default from English to Spanish, sign out, and then upon signing in everything will be in Spanish as expected. Besides automating the above process is there a more direct way to change Windows' settings using AutoIt?
  6. Sometimes I overlook the obvious, so I might be doing that here, but what if the user is watching a YouTube video? Come to think of it, I suppose I could deal with situations like that by displaying a prompt with a timeout. If the user doesn't respond I can proceed with my housekeeping and logging out the session. Hmm, but what if the user is rendering something in a CGI program or some other CPU-/HDD-intensive process, and the user isn't present? I think that's what prompted me to ask about the AutoIt definition of "idle". I don't recall at the moment why I didn't want to just use Task Scheduler, and maybe have it spawn an AutoIt script. Nonetheless, isn't it worth noting the different "idle" meanings?
  7. Wow, what can I say but THANK YOU . It works perfectly. I was trying to accomplish something like this a couple years ago, posed the question, and you responded with a script that I tried to disassemble and merge with the background image script. I finally gave up. Had to move on. @UEZ, have the functions you used in your code here, and their abilities, been bundled into a published UDF? Also, please see this comment/"bug report?" I added to your File to Base64 String Code Generator thread.
  8. Wonderful tool! Your examples might need updating. I'm using AutoIt 3.3.14.5 and the concurrent SciTE to see your examples available in your original post. When I use SyntaxCheck or F5 Go, two errors frequently appear for the examples I've tried thus far: 1. #include <WinAPISysWin.au3> needs to be added 2. #ULW_ALPHA must need another include but haven't figured out yet what it is. In the past few days I've just substituted the number 2 in place of it but I'd love to know the real fix.
  9. The following script, thanks largely to @UEZ, displays the attached PNG image on the Windows Desktop. It perfectly renders the sticky note's shadow over whatever's in the background. But here's the catch: I would like to add a line of text, fetched from a variable and using a font of my choice, atop the sticky note. It needs to be part of the same GUI because the sticky note can be dragged and placed anywhere on the screen. Will someone here show me how to add just the additional code needed to accomplish my goal? I have tried sporadically for two years to merge in code from scripts that use GDI+ calls to display text over alpha channels but the challenge has proven beyond me. #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> _GDIPlus_Startup() Global Const $SC_DRAGMOVE = 0xF012 Global $iW, $iH, $hImage, $hBitmap, $hGUI $hImage = _GDIPlus_BitmapCreateFromFile("Using-Note.png") $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST)) GUISetState() _WinAPI_BitmapDisplayTransparentInGUI($hBitmap, $hGUI) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBitmap) _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() GUIDelete() Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN
  10. Thank you for the suggestion, @junkew.
  11. Thank you very much, @Subz. Such an obvious and simple solution! (now that I see it )
  12. My program displays a list of "house rules" in a form, provides a checkbox for the user to agree to the rules, asks for the user's first and last name, and allows the user to either Cancel (bail out and log off) or OK it and continue on. I'm using OnEvent Mode to process the user's response to the form. As you'll see in the comments below I can't figure out how to return to the main body of my program after the user clicks the OK button. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; remember that when the above is enabled all variables declared within the Program region must be Global. #Region - Main Body (or at least I'd like it to be!) Opt("GUIOnEventMode", 1) Global $Form1, $idInput1, $idInput2, $Button2, $sFN, $sLN _DisplayForm() ; display agreement form ; next step in program (if I can get back here) MsgBox($MB_SYSTEMMODAL, "Results", "returned to main body") Exit #EndRegion - Main Body #Region - Functions Func _DisplayForm() $Form1 = GUICreate("Form1", 679, 438, 192, 124) ; ask firstname $idInput1 = GUICtrlCreateInput("", 56, 360, 169, 21) ; ask lastname $idInput2 = GUICtrlCreateInput("", 240, 360, 177, 21) ; add labels GUICtrlCreateLabel("Enter first name", 56, 336, 77, 17) GUICtrlCreateLabel("Enter last name", 240, 336, 77, 17) GUICtrlCreateLabel("I agree", 480, 336, 37, 17) ; checkbox for agreement GUICtrlCreateCheckbox("Checkbox1", 456, 336, 17, 17) GUICtrlSetOnEvent(-1, "Checkbox1Click") ; allow bail out GUICtrlCreateButton("Cancel", 464, 368, 73, 33) GUICtrlSetOnEvent(-1, "_CancelPressed") ; OK available only if checkbox checked $Button2 = GUICtrlCreateButton("Okay", 560, 368, 81, 33) GUICtrlSetOnEvent(-1, "_OKPressed") GUICtrlSetState($Button2, $GUI_DISABLE) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd EndFunc ;==>_DisplayForm Func _CancelPressed() MsgBox($MB_SYSTEMMODAL, "Results", "Cancel pressed") Exit ; if no agreement then exit EndFunc ;==>_CancelPressed Func _OKPressed() ; THIS IS THE FUNCTION FROM WHICH I NEED TO RETURN TO MAIN BODY $sFN = GUICtrlRead($idInput1) $sLN = GUICtrlRead($idInput2) MsgBox($MB_SYSTEMMODAL, "Results", "firstname: " & $sFN & @CRLF & "lastname: " & $sLN) ; HOW DO I RETURN TO THE MAIN PROGRAM BODY? ; Return just takes me back to _DisplayForm instead of the main prog ; Setting a variable here and checking for it in _DisplayForm's While/WEnd loop doesn't work either EndFunc ;==>_OKPressed Func Checkbox1Click() GUICtrlSetState($Button2, $GUI_ENABLE) EndFunc ;==>Checkbox1Click #EndRegion - Functions I've Googled the topic of exiting a function early but have found nothing applicable to my situation. I even tried the techniques from this old post, to no avail. I have rewritten the form code using MessageLoop Mode, so I have a Plan B, but am curious if there's a solution.
  13. Thank you for answering, @BrewManNH! So it sounds like "idle" here really means "user idle". Can AutoIt access Windows' idle function, thereby taking into account hardware activity, too?
  14. I had watched several of his videos and every time he typed EndFunc the <== comment appeared. But NOT in the video whose link I posted. I apologize to you, @mLipok. So I randomly chose one of his other tutorials and scrubbed through looking for him typing EndFunc. After finding one, and upon playback, he just happened to mumble, "press control to neaten up". Bingo. He must be running Tidy every time he finishes adding a function. The comment gets added so fast it appears he's hitting the tab key to complete EndFunc, and the comment appears immediately. But he happened to think aloud in this one instance, so case closed. Thank you for your effort.
  15. Every script, post and Help file entry that I have read defines "idle" as no mouse or keyboard activity. "i.e" means "for example", which a lawyer would say means "includes but is not limited to". Leaving that thought dangling... This article, "The Definition of Windows Idle," says: How do you reconcile the two? If we're referring to the same measurement of "idle" it would mean that Task Scheduler's "on idle" will trigger after 600,000 ticks as measured by _Timer_GetIdleTime, correct?
×
×
  • Create New...