I have found working wallpaper changer script which activates with win+a but I want to change it to F9+w
The script is this one
Code: Select all
; Initial Preferences
#SingleInstance Force
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
; Few global variables
IniFile = %A_ScriptDir%\wpchange.ini
TempWallpaper = %A_MyDocuments%\currentwallpaper.jpg
IniRead, WallPaperFolder, %IniFile%, Settings, WPFolder, NOT_SET ; Read settings from IniFile
If WallPaperFolder = NOT_SET ; If there is no IniFile, or it's set for Reset
{
FileSelectFolder, SetFolder, , 3 ; Show a folder for the wallpapers
if SetFolder =
{
MsgBox, You didn't select a folder, the program will now close. ; We can't function without a folder, if the user didn't select one, exit.
ExitApp
}
else
{
SetFolder := RegExReplace(SetFolder, "\\$") ; Removes the trailing backslash, if present.
WallPaperFolder = %SetFolder%\ ; We need the trailing backslash for our purposes, but removing it first eliminates the possibility of dual slashes.
IniWrite, %WallPaperFolder%, %IniFile%, Settings, WPFolder ; Now that we have all the settings, write them to IniFile so we don't need to ask them again at relaunch
MsgBox Setting saved. To reset, choose the "Reset Folder" item from tray or delete file %IniFile%.`n`nYou can now change your wallpaper at will by pressing "Win+A". The program will select a random image from the folder you provided and set it as your wallpaper.
}
}
RefreshWPs()
{
Global
ArrayCount=0
Loop, %WallPaperFolder%*.jpg ; check all jpg images in the WallpaperFolder
{
ArrayCount+=1
Array%ArrayCount% := A_LoopFileName ; Make an array of all the available filenames
}
}
ChangeWP()
{
global
Random, filenum, 1, %ArrayCount%
filecalled := Array%filenum% ; select a random image to be set as the new paper
TrayTip, Wallpaper Changer, Setting "%filecalled%" as your wallpaper,,1
FileCopy, %WallPaperFolder%%filecalled%, %TempWallpaper%, 1 ; copy the file to a temp location
FileCopyError = %ErrorLevel%
If ErrorLevel = 1
{
MsgBox While copying %WallPaperFolder%%filecalled% to a temporary location at %TempWallpaper%, a FileCopy error occured, please contact the developer!
}
DllCall("SystemParametersInfo", UInt, 0x14, UInt, 0, Str, TempWallpaper, UInt, 2)
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, WallPaper, %WallPaperFolder%%filecalled%
Sleep, 500 ; can't change the wallpaper too quickly in succession.
return
}
Traytip, Wallpaper Changer, Refreshing Wallpapers...,,1
RefreshWPs()
TrayTip, Wallpaper Changer, Wallpaper list refreshed! (%ArrayCount% Found),,1
Menu, TRAY, Add
Menu, TRAY, Add, Refresh Wallpapers, RefreshWallpapers ; Manual refresh
Menu, TRAY, Add, Change Wallpaper, ChangeWallpaper ; Add a menu for it too
Menu, TRAY, Add
Menu, TRAY, Add, Reset Folder, RstFolder ; Add menu for resetting folder
Return ; Ends the auto-execute section
RefreshWallpapers: ; does the same job as the auto-execute
Traytip, Wallpaper Changer, Refreshing Wallpapers...,,1
RefreshWPs()
TrayTip, Wallpaper Changer, Wallpaper list refreshed! (%ArrayCount% Found),,1
Return
ChangeWallpaper:
ChangeWP()
Return
RstFolder:
MsgBox, 52, Wallpaper Changer, Resetting folder settings requires program restart. You can choose new folder on next launch. Do you want to reset the settings and close the application now?
IfMsgBox Yes
{
IniWrite, NOT_SET, %IniFile%, Settings, WPFolder ; Set the WPFolder as "NOT_SET" so next launch the user can choose a new folder.
ExitApp
}
Else
{
TrayTip, Wallpaper Changer, Reset cancelled. Nothing done!,,1 ; Inform the user that we did nothing when "No" was clicked.
}
Return
#a::ChangeWP()
==================================================