Jump to content

Autoitte Boş Alan Kontrol Ettirme


ByIdris
 Share

Recommended Posts

  • Editor
Local $aArray = DriveGetDrive("ALL")
If @error Then
    MsgBox(4096, "DriveGetDrive", "It appears an error occurred.")
Else
    For $i = 1 To $aArray[0]
        Local $iFreeSpace = DriveSpaceFree(StringUpper($aArray[$i]) & "\")
        MsgBox(4096, "Free Space:",StringUpper($aArray[$i]) & "sürücüsü boş alanı " & $iFreeSpace & " MB")
    Next
EndIf
 

 

Help dosyasında var kardeşim bakarsın arada.

Link to comment
Share on other sites

Ufak bir fonksiyon yazdım. İşini görür umarım.

 


Func IsDriveFree($Drive, $FreeMB)

	If StringRight($Drive, 1) <> "\" And StringRight($Drive, 1) <> ":" Then $Drive &= ":"
	Local $DSFree =  DriveSpaceFree($Drive)

	If $DSFree > $FreeMB Then Return SetError(0, $DSFree, True)
	Return False

EndFunc

If IsDriveFree(@HomeDrive, 1000) Then MsgBox(0, "", "İstediğiniz kadar boş alan mevcut" & @CRLF & @extended & " MB boş alan var.")

If Not IsDriveFree(@HomeDrive, 1000000) Then MsgBox(0,"Maalesef", "Çok geride kalmışsınız! Bence hemen yeni bir hard disk alın.")

 

 

Edited by asmazh
Link to comment
Share on other sites

Func IsDriveFree($Drive, $FreeMB)
	If StringRight($Drive, 1) <> "\" And StringRight($Drive, 1) <> ":" Then $Drive &= ":"
	Local $DSFree =  DriveSpaceFree($Drive)
	If $DSFree > $FreeMB Then Return SetError(0, $DSFree, True)
	Return False
EndFunc
If IsDriveFree("C:\",15000) Then
	Global $NEREYE="C:\"
	Global $UZERINI_YAZ=1
If Not IsDriveFree("D:\",1000000) Then
	Global $NEREYE="D:\"
	Global $UZERINI_YAZ=1
If Not IsDriveFree("E:\",1000000) Then
	Global $NEREYE="E:\"
	Global $UZERINI_YAZ=1
EndIf
EndIf
EndIf

verdiğin kodları düzenledim ama öyle bir bölüm yoksa otomatik diğerine geçiyor mu? bunu bir soriyim dedim.

Link to comment
Share on other sites

Func IsDriveFree($Drive, $FreeMB)
	If StringRight($Drive, 1) <> "\" And StringRight($Drive, 1) <> ":" Then $Drive &= ":"
	Local $DSFree = DriveSpaceFree($Drive)
	If $DSFree > $FreeMB Then Return SetError(0, $DSFree, True)
	Return False
EndFunc   ;==>IsDriveFree


Local $Array_Drives = DriveGetDrive("FIXED"), $Drives, $FreeMB = 10000 ; - 10 GB'lık boş alan araması yapalım.
If Not @error Then
	For $x = 1 To $Array_Drives[0]
		If IsDriveFree($Array_Drives[$x], $FreeMB) Then $Drives &= ">> " & ($Array_Drives[$x]) & " <<" & _
				" Bu diskte tam olarak " & @extended & _
				" MB boş alan mevcut." & @CRLF

	Next
	Exit MsgBox(0, "", $Drives)
EndIf

MsgBox(0, "", "Dostum böyle bir bilgisayar kullandığın için kendinden utanmalısın.") ; - Bu mesajı aldıysan ters giden bir şeyler var demektir.

 

 

 
 
Yazdığım fonksiyon sadece belirlediğin diskte istediğin kadar boş alan var mı diye kontrol eder. Varsa dönüş değeri "True", @extended değeri olarak da toplam boş alanı döner. Eğer istediğin kadar boş alan yok ise de "False" döner. Tüm diskleri kontrol etmek için bir döngü kurmalısın. Senin için kurdum, ama sorduğun soruların cevaplarını AutoIt'in "Help" klasöründe biraz gezinerek bulabilirsin.

Edited by asmazh
Link to comment
Share on other sites

abi yardımcı oldunda autoit help klasörüne baktım işime yarayan kodları ekledim ama olmadı msgbox sildim bir iki kod ekledim beceremedim
en son yazdığın kod güzel ona bir iki kod daha eklersen sevinirim misal ilk gelen harddisk üzerinde işlem yapma kodunuda verebilirsen sevinirim

Edited by ByIdris
Link to comment
Share on other sites

Local $aArray = DriveGetDrive("FIXED")
    For $i = 1 To $aArray[0]
        $drive = StringUpper($aArray[$i])
		Local $iFreeSpace = DriveSpaceFree($drive & "\") 
		$iFreeSpacegb = $iFreeSpace / 1000
		$iFreeSpacegb2 = Round ( $iFreeSpacegb ,2)
		MsgBox(4096, "Bilgi" , $drive&" Boşluk miktarı : "& $iFreeSpacegb2 & " GB")
    Next

gerisi sana kalmış

Link to comment
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.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...