
JeffAllenNJ
Members-
Posts
2 -
Joined
-
Last visited
Everything posted by JeffAllenNJ
-
DllCall kernel32 SetThreadExecutionState
JeffAllenNJ replied to JeffAllenNJ's topic in AutoIt General Help and Support
@Nine, yes, I want the screensaver to be disabled only under certain conditions which I will control progamatically. After that, I was the screensaver to go back to normal. -
That said, I've seen posts on this forum before aimed at keeping screen savers from kicking in and such. However, all those posts seemed too old for me to resurrect. So, I thought it best to start a new one. The following command successfully prevents my screen saver from kicking in: Local $aRet = DllCall('kernel32.dll', 'long', 'SetThreadExecutionState', 'long', 0x80000003) ; reset system and display idle timers (continuous) The problem is that the call to reset the power state has never been working for me. When I issue the call below, my screen saver never kicks in. Local $aRet = DllCall('kernel32.dll', 'long', 'SetThreadExecutionState', 'long', 0x80000000) ; power reset state NOTE: I've been on this forum for many years but, for some reason, I had to create a new account with an "@" in it. Suffice it to say, this is not my first post.
-
I've been running this code for years and, suddenly, I'm getting "Error occurred when reading data using the transpose method." with the call to _Excel_RangeRead. $oExcel = _Excel_Open(False, False, False, False, True) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "loadAllSongs", "_Excel_Open" & @CRLF & "@error = " & @error & @CRLF & "@extended = " & @extended) $msg = '' $oWorkbook = _Excel_BookOpen($oExcel, $wbName, Default, Default, True) Select Case @error = 1 $msg = "1: $oExcel is not an object or not an application object" Case @error = 2 $msg = "2: Specified $sFilePath does not exist" Case @error = 3 $msg = "3: Unable to open $sFilePath" Case @error = 4 $msg = "4: "& $wbName & " already open" EndSelect If $msg <> '' Then ws("msg", $msg) $resp = MsgBox($MB_YESNOCANCEL, "loadAllSongs", "_Excel_BookOpen " & $wbName & @CRLF & @CRLF & $cellRange & @CRLF & @CRLF & $msg & @CRLF & @CRLF & "Close without saving?") Select Case $resp = $IDyes _Excel_BookClose($wbName, False) ws(@error,@extended) Case $resp = $IDCancel Exit EndSelect EndIf $oWorkbook.WorkSheets($wsName).Activate $msg = '' $aSongs = _Excel_RangeRead($oWorkbook, $wsName, $cellRange) Select Case @error = 1 $msg = "1: " & $wbName & " is not an object or not a workbook object" Case @error = 2 $msg = "2: " & $wsName & " name or index invalid or is not a worksheet object." Case @error = 3 $msg = "3: " & $cellRange & " is invalid. @extended is set to the COM error code" Case @error = 4 $msg = "4: Parameter $iReturn is invalid. Has to be >= 1 and <= 4" Case @error = 5 $msg = "5: Error occurred when reading data using the transpose method." Case @error = 6 $msg = "6: Maximum size of an AutoIt array exceeded (2^24 = 16,777,216 elements)" Case @error = 7 $msg = "7: Error occurred when reading data using the _ArrayTranspose function." Case @error = 8 $msg = "8: $iReturn = 3 can only return a single cell. $vRange specified > 1 cell." EndSelect If $msg <> '' Then _Excel_Close($oExcel) ws("msg", $msg) Exit MsgBox($MB_SYSTEMMODAL, "loadAllSongs", "_Excel_RangeRead " & $wbName & @CRLF & @CRLF & $wsName & @CRLF & @CRLF & $cellRange & @CRLF & @CRLF & $msg) EndIf
-
Scripts aren't running
JeffAllenNJ replied to JeffAllenNJ's topic in AutoIt General Help and Support
So, I guess my question boils down to trying to understand why every app on my PC can see files on G:\My Drive\... ... except for AutoIT3.exe! -
Scripts aren't running
JeffAllenNJ replied to JeffAllenNJ's topic in AutoIt General Help and Support
This has something to do with Google Drive (G:\My Drive\...). I modified test.au3 to contain the line Local $sAnswer = InputBox("Question", "Where were you born?", "Planet Earth", "", -1, -1, 0, 0). When I run it from G:\My Drive\..., I get nothing. When I save it in C:\me\Documents\, it runs fine. From CMD, when I try "C:\Program Files (x86)\AutoIt3\autoit3.exe" "G:\My Drive\test.au3", I get nothing. The command seems to succeed but I do not get the prompt. From CMD, when I try "C:\Program Files (x86)\AutoIt3\autoit3.exe" "C:\me\Documents\test.au3", It works. I get the prompt. -
When running TEST.au3: ConsoleWrite(@CRLF) ConsoleWrite(@CRLF) ConsoleWrite(@CRLF) ConsoleWrite(@CRLF) ConsoleWrite(@CRLF) ConsoleWrite(@CRLF) I get: >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "G:\My Drive\Documents\AutoIT\test.au3" /UserParams +>07:52:40 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00000409 OS:WIN_11/2009 CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\me\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\me\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.16.1) from:C:\Program Files (x86)\AutoIt3 input:G:\My Drive\Documents\AutoIT\test.au3 +>07:52:40 AU3Check ended.rc:0 >Running:(3.3.16.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "G:\My Drive\Documents\AutoIT\test.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. +>07:52:41 AutoIt3.exe ended.rc:0 +>07:52:41 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.259 Why aren't my scripts actually running?
-
Seems simple but ... not working ... has something changed? run("C:\Windows\System32\scrnsave.scr/S") Exit
-
FileCreateShortcut not working
JeffAllenNJ replied to JeffAllenNJ's topic in AutoIt General Help and Support
SOLVED! %appdata% doesn't work for autoit so I replaced it with @AppDataDir. -
This code: $script = StringSplit(@ScriptName, '.') $link = '%appdata%\Microsoft\Windows\Start Menu\Programs\Startup\' & $script[1] & '.lnk' ConsoleWrite('path: ' & @ScriptFullPath & @CRLF) ConsoleWrite('link: ' & $link & @CRLF) If Not FileExists($link) Then If MsgBox($MB_YESNO, $script[1], 'Add ' & $script[1] & ' to startup?', 'Y') = $IDYES Then FileCreateShortcut(@ScriptFullPath,$link) ConsoleWrite(@error&' @error'&@CRLF&@extended&' @extended'&@CRLF) EndIf EndIf Yields: path: C:\Users\jallen\Documents\AutoIT\SmartCapsLock.au3 link: %appdata%\Microsoft\Windows\Start Menu\Programs\Startup\SmartCapsLock.lnk 0 @error 0 @extended I don't think it's a priv thing because (a) it's my own startup folder (b) I can create the shortcut manually in explorer and (c) I HAVE ADMIN!
-
If anyone finds this helpful (or wants to help improve my code), I have a small app that I'm testing which will keep track of CAPS-LOCK on a window-by-window basis. Suppose you are in Excel where you need to type data in all CAPS but then you get a message on TEAMS or WHATSAPP requiring a quick response. Currently, if you switch to TEAMS or WHATSAPP, it will inherit your PC's CAPSLOCK setting and your responses will all be in UPPERCASE. With SmartCapsLock running in the background, it will keep track of which apps have CAPSLOCK on or OFF and adjust it accordingly. If a user explicitly turns CAPSLOCK on, it will only be active for that APP. Now, when you switch to TEAMS or WHATSAPP, your PC will be set to lowercase and, when you switch back to EXCEL, it will be restored to UPPERCASE. If you explicitly turn off CAPSLOCK in EXCEL, It will be remembered as well. #include-once #include <WinAPI.au3> #include <MyFunctions.au3> Opt('SendCapslockMode', 0) Dim $actList[0][3] ; 3-col (pid, name, capslock-flag) active process array (processes that have been active) $hActive = WinGetHandle("[active]") ; most recently active window handle While True ; loop forever $winList = WinList() ; Get list of windows For $iWin = 1 To $winList[0][0] ; For each window $tWnd = $winList[$iWin][0] ; get window title $hWnd = $winList[$iWin][1] ; get window handle If $tWnd = 'Task Switching' Then ContinueLoop ; skip this process If $tWnd <> '' Then ; process has a name If WinActive($hWnd) Then ; this is the active process with focus $iAct = _ArraySearch($actList, $hWnd) ; Find in active process list If $iAct < 0 Then ; Add new process to active process list $iAct = _ArrayAdd($actList, $hWnd) ; [0] window handle $actList[$iAct][1] = $tWnd ; [1] window title $actList[$iAct][2] = _SetCapsLock(False) ; [2] default to lowercase Else ; This process has been active before If $hActive = $hWnd Then ; This was the active process last time around $actList[$iAct][2] = _GetCapsLock() ; Store new capslock setting Else ; Process just became active again _SetCapsLock($actList[$iAct][2]) ; Restore previously saved capslock for this process EndIf ; If $active <> $iAct EndIf ; If $iAct < 0 $hActive = $hWnd ; Remember previous active window handle EndIf ; If WinActive($tWnd) EndIf ; If $tWnd <> '' Next ; For $iWin = 1 To $winList[0][0] Sleep(1) WEnd ; While True Exit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _GetCapsLock() ; Determine capslock setting for newly tracked process $VK_CAPS = 0x14 Local $ret = DllCall('user32.dll', 'long', 'GetKeyState', 'long', $VK_CAPS) If @error Then Return SetError(1, 0, 0) Return BitAND($Ret[0], 1) EndFunc ;==>_GetCapsLock ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _SetCapsLock($lock) ; Restore previously saved capslock setting If $lock Then Send('{CapsLock on}') Else Send('{CapsLock off}') EndIf Return $lock EndFunc ;==>_SetCapsLock ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
There's no problem with the _SMS package but I was curious if anyone knows why vtext no longer works for Verizon.
-
it worked!!!!
-
What does that mean?
-
great pic. any instructions?
-
how can an app send emails from a gmail account? FYI: google has removed the ALLOW LESS SECURE APPS thing.
-
Sorry to "resurrect" but gmail seems to have disabled the ALLOW LESS SECURE APPs thing. Is there another way my app can send emails?
-
How to add Tooltips to Context menu
JeffAllenNJ replied to MacScript's topic in AutoIt GUI Help and Support
In 2022, the help file implies that GUICtrlSetTip works for any GUICtrlCreate...() function. Is everyone certain that GUICtrlSetTip doesn't work for GUICtrlCreateMenuItem? I know I can't get it to work ... I get a return value of 0. #include <GUIConstantsEx.au3> Example() Func Example() GUICreate("My GUI control tip") ; will create a dialog box that when displayed is centered GUICtrlCreateLabel("my label", 10, 20) GUICtrlSetTip(-1, "tip of my label") $x = GUICtrlCreateMenu("&menu") GUICtrlSetTip(-1, "menu") GUICtrlCreateMenuItem("1",$x) GUICtrlSetTip(-1, "first option") GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example -
GUICtrlCreateEdit increase max length?
JeffAllenNJ replied to BPCM's topic in AutoIt General Help and Support
Is there any documentation as to what the current limits are for various gui controls? I'm just asking because I'd like to see the current limit so that I can gauge how much to increase it by. -
TraySetToolTip 128 char limit
JeffAllenNJ replied to JeffAllenNJ's topic in AutoIt General Help and Support
The example for toast is nice but is there a way to suppress display until the user hovers over the system tray icon? This is how TraySetToolTip works. -
TraySetToolTip 128 char limit
JeffAllenNJ replied to JeffAllenNJ's topic in AutoIt General Help and Support
I did see mention of TOAST in one of the other posts but the link was DOA. Thanks for the updated url. -
I'd like one of my scripts to be able to show the last ten lines of its log file in a tool tip. Testing has shown that TraySetToolTip is limited to 128 characters. Is there a way around this?
-
Sorry to resurrect but I don't seem to notice dark theme being native to SciTE Version 4.1.2. and Argumentum has the best dark theme I have found. Upon implementation of Argumentum's theme, my question pertains to text in the console window that follows colons. Right now, it's black and tricky to pickup in the dark console window. How do I adjust that color? Better yet, where do I find documentation as to what all the "styles" and "lexers" are?
-
Windows Environment Variables
JeffAllenNJ replied to JeffAllenNJ's topic in AutoIt General Help and Support
Has anyone considered replacing the stock EnvGet, EnvSet, and EnvUpdate functions with Subz's code?