Kod: Tümünü seç
#!/bin/bash
# Dönüşüm seçimi
secim=$(zenity --list \
--title="Dönüşüm Seçimi" \
--column="Seçenek" --column="Açıklama" \
1 "Celsius → Fahrenheit" \
2 "Fahrenheit → Celsius" \
3 "Celsius → Kelvin" \
4 "Kelvin → Celsius" \
--height=300 --width=400)
# İptal kontrolü
if [ -z "$secim" ]; then
zenity --question --title="Çıkış Onayı" --text="Programdan çıkmak istediğinizden emin misiniz?"
[ $? -eq 0 ] && exit 0
fi
# Sıcaklık değeri al
temp=$(zenity --entry \
--title="Sıcaklık Girişi" \
--text="Lütfen sıcaklık değerini girin:")
# İptal kontrolü
[ -z "$temp" ] && exit 0
# Virgül varsa noktaya çevir
temp=${temp//,/\.}
# Sayısal kontrol
if ! [[ "$temp" =~ ^-?[0-9]+([.][0-9]+)?$ ]]; then
zenity --error --title="Hata" --text="Lütfen geçerli bir sayı girin."
exit 1
fi
# Hesaplama
case "$secim" in
1)
sonuc=$(echo "scale=4; ($temp * 9 / 5) + 32" | bc)
birim="°F"
;;
2)
sonuc=$(echo "scale=4; ($temp - 32) * 5 / 9" | bc)
birim="°C"
;;
3)
sonuc=$(echo "scale=4; $temp + 273.15" | bc)
birim="Kelvin"
;;
4)
sonuc=$(echo "scale=4; $temp - 273.15" | bc)
birim="°C"
;;
*)
zenity --error --text="Geçersiz seçim."
exit 1
;;
esac
sonuc_round=$(printf "%.2f" "$sonuc")
zenity --info \
--title="Sonuç" \
--text="Sıcaklık: $sonuc_round $birim"
# Masaüstü yolu (Mint için)
dosyayolu="$HOME/Masaüstü/sicaklik_donusum_sonucu.txt"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Dönüşüm Sonucu: $sonuc_round $birim" >> "$dosyayolu"
zenity --info \
--title="Kaydedildi" \
--text="Sonuç masaüstüne kaydedildi:\n$dosyayolu"




Betiğin Windows11 versiyonu aşağıda
Kod: Tümünü seç
Option Explicit
Dim secim
Dim temp
Dim sonuc
Dim dosyayolu
Dim fso
Dim dosyanumarasi
Dim cevap
Dim stream
' Kullanıcıdan dönüşüm türünü seçmesini iste
secim = InputBox("Celsius - Fahrenheit için 1, Fahrenheit - Celsius için 2, Celsius - Kelvin için 3, Kelvin - Celsius için 4 girin:", "Dönüşüm Seçimi")
' Kullanıcı iptal butonuna basarsa
If secim = "" Then
cevap = MsgBox("Programdan çıkmak istediğinizde emin misiniz?", vbYesNo + vbQuestion, "Çıkış Onayı")
If cevap = vbYes Then WScript.Quit
End If
' Seçime göre dönüşüm işlemi
If secim = "1" Then
' Celsius - Fahrenheit Dönüşümü
temp = InputBox("Lütfen Celsius cinsinden sıcaklığı girin:", "Celsius - Fahrenheit Dönüştürücü")
If IsNumeric(temp) Then
sonuc = (CDbl(temp) * 9 / 5) + 32
MsgBox "Sıcaklık: " & Round(sonuc, 2) & " derece F.", vbInformation, "Sonuç"
Else
MsgBox "Lütfen geçerli bir sayı girin.", vbExclamation, "Hata"
WScript.Quit
End If
ElseIf secim = "2" Then
' Fahrenheit - Celsius Dönüşümü
temp = InputBox("Lütfen Fahrenheit cinsinden sıcaklığı girin:", "Fahrenheit - Celsius Dönüştürücü")
If IsNumeric(temp) Then
sonuc = (CDbl(temp) - 32) * 5 / 9
MsgBox "Sıcaklık: " & Round(sonuc, 2) & " derece C.", vbInformation, "Sonuç"
Else
MsgBox "Lütfen geçerli bir sayı girin.", vbExclamation, "Hata"
WScript.Quit
End If
ElseIf secim = "3" Then
' Celsius - Kelvin Dönüşümü
temp = InputBox("Lütfen Celsius cinsinden sıcaklığı girin:", "Celsius - Kelvin Dönüştürücü")
If IsNumeric(temp) Then
sonuc = CDbl(temp) + 273.15
MsgBox "Sıcaklık: " & Round(sonuc, 2) & " Kelvin.", vbInformation, "Sonuç"
Else
MsgBox "Lütfen geçerli bir sayı girin.", vbExclamation, "Hata"
WScript.Quit
End If
ElseIf secim = "4" Then
' Kelvin - Celsius Dönüşümü
temp = InputBox("Lütfen Kelvin cinsinden sıcaklığı girin:", "Kelvin - Celsius Dönüştürücü")
If IsNumeric(temp) Then
sonuc = CDbl(temp) - 273.15
MsgBox "Sıcaklık: " & Round(sonuc, 2) & " derece C.", vbInformation, "Sonuç"
Else
MsgBox "Lütfen geçerli bir sayı girin.", vbExclamation, "Hata"
WScript.Quit
End If
Else
MsgBox "Lütfen geçerli bir seçim yapın (1, 2, 3 veya 4).", vbExclamation, "Hata"
WScript.Quit
End If
' Sonucu dosyaya kaydet
dosyayolu = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\sicaklik_donusum_sonucu.txt"
' ADODB.Stream nesnesi ile dosyayı UTF-8 formatında kaydet
Set stream = CreateObject("ADODB.Stream")
stream.Type = 2 ' Metin
stream.Charset = "utf-8"
stream.Open
stream.WriteText "Dönüşüm Sonucu: " & Round(sonuc, 2)
stream.SaveToFile dosyayolu, 2 ' 2 = Üzerine yaz
stream.Close
MsgBox "Sonuç masaüstüne kaydedildi: " & dosyayolu, vbInformation, "Kaydedildi"






