Jump to content
Sign in to follow this  
Skorpion

Arkaplan Degistirme Kod Hatasi

Recommended Posts

Arkaplan degistirme kod hatasi

Selam arkadaslar bir script var bununla önceden masaüstü arka plani sorunsuz degistiriyordum 

yanlislikla biryerinimi degistirdim naptim simdi calismiyor hata nerede acaba bakabilirmisiniz

 

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\test2.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Dim $favDir = @MyDocumentsDir & "\Wall\"

Dim $cCounter = 0
Dim $FindFile = FileFindFirstFile($favDir & '*.bmp')
While 1
	FileFindNextFile($FindFile)
	If @error Then ExitLoop
	$cCounter = $cCounter + 1
WEnd
FileClose($FindFile)

$FindFile = FileFindFirstFile($favDir & '*.bmp')
Dim $RandomNum = Random(1, $cCounter, 1)

Dim $curFile
For $i = 1 To $RandomNum
	$curFile = FileFindNextFile($FindFile)
	 If $RandomNum = $i Then
		 ChangeDesktopWallpaper($favDir & $curFile)
		 ExitLoop
	 EndIf
Next

FileClose($FindFile)

Exit

Func ChangeDesktopWallpaper($bmp)
;===============================================================================
; Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp')
; Parameter(s): $bmp - Full Path to BitMap File (*.bmp)
; Requirement(s): None.
; Return Value(s): On Success - Returns 0
; On Failure - -1
;===============================================================================

If Not FileExists($bmp) Then Return -1
;The $SPI* values could be defined elsewhere via #include - if you conflict,
; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic
Local $SPI_SETDESKWALLPAPER = 20
Local $SPIF_UPDATEINIFILE = 1
Local $SPIF_SENDCHANGE = 2
Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop"

;Don't tile -  just center
RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0)
RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0)
RegWrite($REG_DESKTOP, "Wallpaper", "REG_SZ", $bmp)

DllCall("user32.dll", "int", "SystemParametersInfo", _
"int", $SPI_SETDESKWALLPAPER, _
"int", 0, _
"str", $bmp, _
"int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))

Return 0
EndFunc;==>_ChangeDestopWallpaper

 

Share this post


Link to post
Share on other sites

En altta destop yazmışsın acaba yapıştırırken mi yanlış yapıştırdın yoksa kodun mu öyle

  • Like 1

Share this post


Link to post
Share on other sites

Selam,

Uzantıları değiştirmiş olabilir misin? Bende jpg yaptığım zaman gayet güzel çalışıyor.

#RequireAdmin
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\test2.ico
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
Dim $favDir = @DesktopDir & "\Wall\"

Dim $cCounter = 0
Dim $FindFile = FileFindFirstFile($favDir & '*.jpg')
While 1
	FileFindNextFile($FindFile)
	If @error Then ExitLoop
	$cCounter = $cCounter + 1
WEnd
FileClose($FindFile)

$FindFile = FileFindFirstFile($favDir & '*.jpg')
Dim $RandomNum = Random(1, $cCounter, 1)

Dim $curFile
For $i = 1 To $RandomNum
	$curFile = FileFindNextFile($FindFile)
	If $RandomNum = $i Then
		ChangeDesktopWallpaper($favDir & $curFile)
		ExitLoop
	EndIf
Next

FileClose($FindFile)

Exit

Func ChangeDesktopWallpaper($bmp)
	;===============================================================================
	; Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp')
	; Parameter(s): $bmp - Full Path to BitMap File (*.bmp)
	; Requirement(s): None.
	; Return Value(s): On Success - Returns 0
	; On Failure - -1
	;===============================================================================

	If Not FileExists($bmp) Then Return -1
	;The $SPI* values could be defined elsewhere via #include - if you conflict,
	; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic
	Local $SPI_SETDESKWALLPAPER = 20
	Local $SPIF_UPDATEINIFILE = 1
	Local $SPIF_SENDCHANGE = 2
	Local $REG_DESKTOP = "HKEY_CURRENT_USER\Control Panel\Desktop"

	;Don't tile -  just center
	RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0)
	RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0)
	RegWrite($REG_DESKTOP, "Wallpaper", "REG_SZ", $bmp)

	DllCall("user32.dll", "int", "SystemParametersInfo", _
			"int", $SPI_SETDESKWALLPAPER, _
			"int", 0, _
			"str", $bmp, _
			"int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))

	Return 0
EndFunc   ;==>ChangeDesktopWallpaper

 

  • Like 1

Share this post


Link to post
Share on other sites

ahh ah hep bu üsengencligimden kaynaklaniyormus

eski sürüm autoit yüklü oldugu icin calismiyormus

simdi hemen oturup ne kadar program varsa hepsini güncelleyecegim

yardimlariniz icin cok tesekkür ederim sagolun

Edited by Skorpion
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...