Jump to content

red0fireus

Active Members
  • Posts

    37
  • Joined

  • Last visited

About red0fireus

  • Birthday 01/03/2000

Recent Profile Visitors

487 profile views

red0fireus's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. For anyone who has the same issue as me. https://forum.rainmeter.net/viewtopic.php?f=103&t=35808&p=181235#p181235
  2. Hello, I want to create a Run command that starts Rainmeter with "Bangs" Bangs are the variables that rainmeter uses to kill specific skins from running. I have figured out how to do it with: Run(@ComSpec & " /c " & '""C:\Program Files\Rainmeter\Rainmeter.exe" !DeactivateConfig "DeuXx\Visualizer\" "Visualizer v.2.ini""', @SystemDir, @SW_HIDE) But my question is how do I change "DeuXx\Visualizer\" and "Visualizer v.2.ini" to variables like $fileFolder and $fileINI I'm very confused on where the " " should start and end to achieve this. Here is my attempt: Global $fileFolder = "Minimalist Weather Standalone\" Global $fileINI = "Minimalist Weather.ini" Run(@ComSpec & " /c " & '""C:\Program Files\Rainmeter\Rainmeter.exe" !DeactivateConfig"' & $fileFolder & $fileINI, @SystemDir, @SW_HIDE) Thank you!
  3. I believe I got it working, I will report back if I still receive the error. Thank you Jos
  4. I'm trying to create a script to detect the Action Center in Windows 10: Opt("WinTitleMatchMode", 4) Opt("WinSearchChildren", 1) While 1 Sleep(50) $hControl = ControlGetHandle("[CLASS:TrayNotifyWnd]", "", "Action Center, No new notifications") If not $hControl = 0x00000000 and Not WinActive("[CLASS:TrayNotifyWnd]") Then ConsoleWrite("True") EndIf Wend I'm having issues detecting the Main Class and Window name of Action Center. I have used the Autoit Window Info Tool without success and I'm currently trying Microsoft Spy++. I want to detect the window when it is active. If anyone has figured this out before or could lend some support it would be much appreciated. I have also done research and think the Class could be Dwm and the Window Title is DWM Notification Window but I have been unsuccessful with both Thank you - red Here is the Failed test with Autoit WindowInfo Tool: Opt("WinTitleMatchMode", 4) Opt("WinSearchChildren", 1) While 1 _ActionCenter() Wend Func _ActionCenter() ;If @error Then MsgBox(16, "Error", "System tray not found") if WinExists("[TITLE:Action center; CLASS:Windows.UI.Core.CoreWindow]") then ConsoleWrite("True") EndIf EndFunc
  5. Hello, I've been playing with Arrays and I'm receiving this error code: "C:\Users\datea\Desktop\New AutoIt v3 Script.au3" (32) : ==> Subscript used on non-accessible variable.: If BitAND(WinGetState($var[$i][1]), 2) and ($aWinRect[2] >= @DesktopWidth) Or ($aWinRect[3] >= @DesktopHeight) then If BitAND(WinGetState($var[$i][1]), 2) and ($aWinRect[2] >= @DesktopWidth) Or ($aWinRect^ ERROR I have found that by opening certain windows when checking for a Maximized window for instance [Class:Shell_TrayWnd] or [CLASS:NotifyIconOverflowWindow] or Opening the Calendar, Side Windows 10 Panel or Volume button I receive this error. I believe it's mostly irrelevant because it only happens sometimes and the code works just find most of the time. I'm new to error checking and creating an "@error" for arrays. I think I need to implement a If @error then ContinueLoop   But I'm not exactly sure how to achieve this because the error is inside the Array I believe? Here is my code snippet that I'm working on #include <WinAPI.au3> Opt("WinTitleMatchMode", 4) Opt("WinSearchChildren", 1) AdlibRegister("_AggIsFullScreen") While 1 $tmp = _AggIsFullScreen() sleep(1000) If $tmp = 1 and ProcessExists("rainmeter.exe") then run("cmd.exe /c taskkill /im rainmeter.exe /f", "", @SW_HIDE) ConsoleWrite("true") elseif $tmp = 0 and not ProcessExists("rainmeter.exe") then Run("C:\Program Files\Rainmeter\rainmeter.exe", "C:\Program Files\Rainmeter", @SW_HIDE) ConsoleWrite("false") EndIf WEnd Func _AggIsFullScreen() $xMousePos = MouseGetPos(0) $yMousePos = MouseGetPos(1) Local $iPid ; Local $iWin Local $hwnd = WinGetHandle ("[ACTIVE]") Local $aWinRect = WinGetPos ($hwnd) Local $var = WinList("[REGEXPTITLE:^(?!Microsoft Text Input Application|Program Manager)(?s).*]") If $xMousePos >= 0 AND $xMousePos < @DesktopWidth AND $yMousePos >= 0 AND $yMousePos < @DesktopHeight and Not WinActive("[CLASS:NotifyIconOverflowWindow]") And Not WinActive("[Class:Shell_TrayWnd]") Then For $i = 1 To $var[0][0] ; $iWin = $var[$i][1] If BitAND(WinGetState($var[$i][1]), 2) and ($aWinRect[2] >= @DesktopWidth) Or ($aWinRect[3] >= @DesktopHeight) then ; is visible $iPid = WinGetProcess($var[$i][1]) If ProcessExists($iPid) Then return 1 else return 0 endIf EndIf Next else return -1 Endif EndFunc Thank you - red
  6. #include <WinAPI.au3> Global $iMonitor AdlibRegister("_AggIsFullScreen") While 1 $tmp = _AggIsFullScreen() sleep(1000) If $tmp = 1 and ProcessExists("rainmeter.exe") then run("cmd.exe /c taskkill /im rainmeter.exe /f", "", @SW_HIDE) ConsoleWrite("monitor 1") elseif $tmp = 0 and not ProcessExists("rainmeter.exe") then Run("C:\Program Files\Rainmeter\rainmeter.exe", "C:\Program Files\Rainmeter", @SW_HIDE) ConsoleWrite("monitor 2") EndIf WEnd Func _AggIsFullScreen() $xMousePos = MouseGetPos(0) $yMousePos = MouseGetPos(1) Local $iPid Local $iWin Local $var = WinList("[REGEXPTITLE:^(?!Microsoft Text Input Application|Program Manager)(?s).*]") If $xMousePos >= 0 AND $xMousePos < @DesktopWidth AND $yMousePos >= 0 AND $yMousePos < @DesktopHeight then For $i = 1 To $var[0][0] $iWin = $var[$i][1] If BitAND(WinGetState($var[$i][1]), 2) and BitAND(WinGetState($iWin), 2) and (StringInStr(WinGetClassList($iWin), 'SHELLDLL_DefView') = 0) And (BitAND(WinGetState($iWin), 2) = 2) And (_WinAPI_GetClientWidth($iWin) = @DesktopWidth) And (_WinAPI_GetClientHeight($iWin) = @DesktopHeight) then ; is visible $iPid = WinGetProcess($var[$i][1]) If ProcessExists($iPid) Then return 1 else return 0 endIf EndIf Next else return -1 Endif EndFunc I took a break and came back and I figured it out. If anyone is interested here is my code
  7. If this is not possible with multiple monitors then that would be good to know too.
  8. #include <WinAPI.au3> while 1 sleep(1000) If IsVisible() = 1 then ConsoleWrite("TRUE") Elseif IsVisible() = 0 then ConsoleWrite("FALSE") EndIF WEnd Func IsVisible() Local $hWnd = DllCall('user32.dll', 'hwnd', 'GetForegroundWindow') $hWnd = $hWnd[0] If (@error) Or ($hWnd = 0) Then Return SetError(1, 0, -1) EndIf If (StringInStr(WinGetClassList($hWnd), 'SHELLDLL_DefView') = 0) And (BitAND(WinGetState($hWnd), 2) = 2) And (_WinAPI_GetClientWidth($hWnd) = @DesktopWidth) And (_WinAPI_GetClientHeight($hWnd) = @DesktopHeight) Then return 1 else return 0 EndIf EndFunc I'm running in to an issue with this script. Currently it finds the Most Active Foreground Window but if I click on another monitor it starts to return False instead of True. I was thinking the best way to fix this would be to get the active windows pid and then if that ProcessExists then keep returning true. I've been working on this for 2 days now (it's probably simple) I'm pretty much worn out and need some kind of hint. (I want to keep returning true even if I click on another monitor) - that's my goal Thank you -
  9. I was able to execute the inner if statement. The inner if statement will only be executed if there are no exe files running stated in the exefiles.txt So my setup is I have a exefiles.txt file where each line has a different running or not running process --------------------------------------------- Exefiles.txt --------------------------------------------- test.exe (fake program) help.exe (fake program) rainmeter.exe (real program) (running) abc.exe (fake program) --------------------------------------------- End --------------------------------------------- With this setup the inner loop will not run and it will return true. If I were to remove the (real program) "rainmeter.exe" then my script will return false. I don't doubt that there was a better way of doing this, I'm trying to write a universal script for people to edit and I thought this would be the best option. The process must also be running for it to return true or 1
  10. #include <File.au3> AdlibRegister("_readFile") If _readFile() = 1 then ConsoleWrite("True!") Elseif _readFile() = 0 then ConsoleWrite("False!") EndIf While 1 Sleep(10) WEnd Func _readFile() $sFilePath = @ScriptDir & "\ExeFiles.txt" FileOpen($sFilePath, 0) For $i = 1 to _FileCountLines($sFilePath) $line = FileReadLine($sFilePath, $i) If ProcessExists($line) then return 1 If not ProcessExists($line) then return 0 endif EndIf Next FileClose($sFilePath) EndFunc Alright, I got it. Thank you
  11. #include <File.au3> AdlibRegister("_readFile") While 1 Sleep(10) WEnd If _readFile() = 1 then ConsoleWrite("True!") Elseif _readFile() = 0 then ConsoleWrite("False!") EndIf Func _readFile() $sFilePath = @ScriptDir & "\ExeFiles.txt" FileOpen($sFilePath, 0) For $i = 1 to _FileCountLines($sFilePath) $line = FileReadLine($sFilePath, $i) If ProcessExists($line) then Return 1 EndIf Return 0 Next FileClose($sFilePath) EndFunc I have the above script and for some reason it will not return 1 or 0. If I replace "Return 1" with ConsoleWrite("True") it returns just fine. I'm not sure what I'm doing wrong.
  12. It's 3:00AM I figured it out! Sorry for the post!
  13. #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Description=Rainmeter Suspend #AutoIt3Wrapper_Res_Fileversion=0.0.0.1 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_ProductName=Rainmeter Suspend #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("TrayAutoPause",0) while 1 sleep(5000) _IsFullScreen() WEnd Func _IsFullScreen () Local $hwnd = WinGetHandle ("[ACTIVE]") Local $aWinRect = WinGetPos ($hwnd) If ($aWinRect[2] >= _WinAPI_GetSystemMetrics($SM_CXSCREEN)) OR ($aWinRect[3] >= _WinAPI_GetSystemMetrics($SM_CYSCREEN)) Then _ProcessSuspend("rainmeter.exe") Else _ProcessResume("rainmeter.exe") EndIf EndFunc Func _ProcessSuspend($process) $processid = ProcessExists($process) If $processid Then $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid) $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0]) DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle) If IsArray($i_sucess) Then Return 1 Else SetError(1) Return 0 Endif Else SetError(2) Return 0 Endif EndFunc Func _ProcessResume($process) $processid = ProcessExists($process) If $processid Then $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid) $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0]) DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle) If IsArray($i_sucess) Then Return 1 Else SetError(1) Return 0 Endif Else SetError(2) Return 0 Endif EndFunc I'm getting this error when running my script: "Error: Subscript used on non-accessible variable" I'm very confused because the script works 99% of the time and then I just get the random error. What am I missing?
  14. #include "DeviceAPI.au3" $DeviceName = "NVIDIA Geforce GTX 1050" $classname = "Display adapters" ;$objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2") ;$m_MediaConnectWatcher = $objWMIService.ExecNotificationQuery("SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_DiskDrive'") AdLibRegister("HWDevice_Detect") While 1 ; ConsoleWrite(@CRLF & "Checking for [" & $DeviceName & "]...") Sleep(5000) WEnd Func HWDevice_Detect($devicename, $classname) Local $DeviceListed = False Local $aClasses = _DeviceAPI_GetClassArray() For $X = 0 to Ubound($aClasses)-1 If $aClasses[$X][2] = $classname Then Local $aDevices = _DeviceAPI_GetDeviceArray($aClasses[$X][0]) For $Y = 0 to Ubound($aDevices)-1 If $aDevices[$Y][1] = $devicename Then $DeviceListed = True EndIf Next EndIf Next If $DeviceListed = True Then Do ConsoleWrite("Device Active") sleep(2000) Until $DeviceListed = False ; AdlibUnRegister("HWDevice_Detect") ElseIf $DeviceListed = False then Do ConsoleWrite("Device Deactive") sleep(2000) Until $DeviceListed = True ; Run(@Comspec & " /c " & "devcon rescan") EndIf EndFunc I got the script working, i just need it to update when it's running. Right now even when the graphics card is connected or disconnected it will still say the same thing. When I run the script and the device is active and then if I temporarily disconnected the Graphics card, it says graphics card is still active and vise versa
  15. #include "DeviceAPI.au3" $DeviceName = "NVIDIA Geforce GTX 1050" $classname = "Display adapters" ;$objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2") ;$m_MediaConnectWatcher = $objWMIService.ExecNotificationQuery("SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_DiskDrive'") AdLibRegister("HWDevice_Detect") While 1 ; ConsoleWrite(@CRLF & "Checking for [" & $DeviceName & "]...") Sleep(5000) WEnd Func HWDevice_Detect($devicename, $classname) Local $DeviceListed = False Local $aClasses = _DeviceAPI_GetClassArray() For $X = 0 to Ubound($aClasses)-1 If $aClasses[$X][2] = $classname Then Local $aDevices = _DeviceAPI_GetDeviceArray($aClasses[$X][0]) For $Y = 0 to Ubound($aDevices)-1 If $aDevices[$Y][1] = $devicename Then $DeviceListed = True EndIf Next EndIf Next If $DeviceListed = True Then ConsoleWrite("Device active") Exit ; AdlibUnRegister("HWDevice_Detect") Else ConsoleWrite("Device Deactive") Exit ; Run(@Comspec & " /c " & "devcon rescan") EndIf EndFunc I changed it a bit and got it somewhat working. Now the issue is getting it to check correctly and repeatedly. It checks correctly first and then i have to exit or it will switch to deactive
×
×
  • Create New...