WindIt Posted April 30, 2020 Share Posted April 30, 2020 I have a small script which will load a black screen saver when Shift+d key is enabled, how do i make this always running in windows10 machine. and always respond to the hotkey. New to auatoit, please excuse me for any brevity. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("+d", "ShowMessage") ;Shift+d While 1 Sleep(100) WEnd Func ShowMessage() Run("C:\Windows\System32\scrnsave.scr /s") EndFunc Link to comment Share on other sites More sharing options...
water Posted April 30, 2020 Share Posted April 30, 2020 Looks correct to me. Do you get any error messages? What doesn't work? BTW: Why don't you use the Windows way and set a shortcut to directly run the Screesaver as described here? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Nine Posted April 30, 2020 Share Posted April 30, 2020 (edited) There might be a redirection issue as he is playing in the system32 folder. And you do not have any error handling. Make sure you can run this file from your script by capturing both pid and @error after run function. Edited April 30, 2020 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
careca Posted April 30, 2020 Share Posted April 30, 2020 Only change i did was the hotkey to F2 and it works fine. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
WindIt Posted May 2, 2020 Author Share Posted May 2, 2020 On 4/30/2020 at 5:40 PM, water said: Looks correct to me. Do you get any error messages? What doesn't work? BTW: Why don't you use the Windows way and set a shortcut to directly run the Screesaver as described here? Hey thanks for the link will try it. I will try it since within corp we are not allowed any external downloaded exe file (but the link has some easy steps to make it work) so decided to use the autoit script. The problem it works but only once not on demand, I need to make it run always and respond to the hotkey each time. Link to comment Share on other sites More sharing options...
WindIt Posted May 2, 2020 Author Share Posted May 2, 2020 On 4/30/2020 at 5:58 PM, careca said: Only change i did was the hotkey to F2 and it works fine. It works once, i need to ensure it works on demand and responds to the hotkey each time. Link to comment Share on other sites More sharing options...
WindIt Posted May 2, 2020 Author Share Posted May 2, 2020 On 4/30/2020 at 5:50 PM, Nine said: There might be a redirection issue as he is playing in the system32 folder. And you do not have any error handling. Make sure you can run this file from your script by capturing both pid and @error after run function. I will give it a try, do have some examples of your suggestion. i am new to autoit. I need it to work on demand and respond to the hotkey. Link to comment Share on other sites More sharing options...
careca Posted May 2, 2020 Share Posted May 2, 2020 No idea what you mean, because for me it works on demand, many times. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{F2}", "ShowMessage") While 1 Sleep(100) WEnd Func ShowMessage() Run("C:\Windows\System32\scrnsave.scr /s") EndFunc What could be happening is the keys getting sticked, shift alt and control are notorious for that. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
WindIt Posted May 4, 2020 Author Share Posted May 4, 2020 On 5/2/2020 at 3:14 PM, careca said: No idea what you mean, because for me it works on demand, many times. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{F2}", "ShowMessage") While 1 Sleep(100) WEnd Func ShowMessage() Run("C:\Windows\System32\scrnsave.scr /s") EndFunc What could be happening is the keys getting sticked, shift alt and control are notorious for that. Thank you, Yes it was the issue with keys getting sticked. careca 1 Link to comment Share on other sites More sharing options...
WindIt Posted May 7, 2020 Author Share Posted May 7, 2020 On 5/2/2020 at 3:14 PM, careca said: No idea what you mean, because for me it works on demand, many times. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{F2}", "ShowMessage") While 1 Sleep(100) WEnd Func ShowMessage() Run("C:\Windows\System32\scrnsave.scr /s") EndFunc What could be happening is the keys getting sticked, shift alt and control are notorious for that. Ok, It works on my laptop, but if the same script on Windows 10 pc it get "Script Paused". What could be causing it and how to over come. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 7, 2020 Developers Share Posted May 7, 2020 Don't click the icon as that will toggle the pause script function. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
careca Posted May 7, 2020 Share Posted May 7, 2020 Or you can add this line to the top: Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
rudi Posted May 7, 2020 Share Posted May 7, 2020 Maybe I miss your intention, but if you just want a hotkey to activate the windows screensaver to LOCK your windows logon session, then simply use the Windows build in hotkey, that's "WIN" + l ("LOWERCASE L", L like "lock") Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
WindIt Posted May 7, 2020 Author Share Posted May 7, 2020 12 hours ago, Jos said: Don't click the icon as that will toggle the pause script function. You mean at the tool bar icon where i see the pause script highlight ? Link to comment Share on other sites More sharing options...
WindIt Posted May 7, 2020 Author Share Posted May 7, 2020 5 hours ago, careca said: Or you can add this line to the top: Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Ok, I made the changes, This should work will let you guys know. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause HotKeySet("{F2}", "ShowMessage") While 1 Sleep(100) WEnd Func ShowMessage() Run("C:\Windows\System32\scrnsave.scr /s") EndFunc Link to comment Share on other sites More sharing options...
WindIt Posted May 7, 2020 Author Share Posted May 7, 2020 (edited) 40 minutes ago, rudi said: Maybe I miss your intention, but if you just want a hotkey to activate the windows screensaver to LOCK your windows logon session, then simply use the Windows build in hotkey, that's "WIN" + l ("LOWERCASE L", L like "lock") Regards, Rudi. No, I cant use that since the test bench (machine) is connected to a display and runs continuously with multi user interaction. Had to go for this solution to have black mute display on demand when not in use. Edited May 7, 2020 by WindIt Link to comment Share on other sites More sharing options...
rudi Posted May 7, 2020 Share Posted May 7, 2020 beside the already mentioned Opt("TrayAutoPause",0) use Opt("TrayIconHide",1), then there is no systray icon at all some fool could click around with. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now