Skip to content

Instantly share code, notes, and snippets.

@arthurschreiber
Forked from anonymous/gist:40315
Created December 27, 2008 21:37
Show Gist options
  • Save arthurschreiber/40316 to your computer and use it in GitHub Desktop.
Save arthurschreiber/40316 to your computer and use it in GitHub Desktop.
autostart = TkVariable.new
autostart_ja_check = TkRadioButton.new(@options_window) do
text 'Ja'
variable autostart
value 'ja'
background 'royalblue'
activebackground 'royalblue'
font TkFont.new('Comic 9 bold')
anchor 'w'
cursor "hand2"
place 'x' => 25, 'y' => 260
end
autostart_nein_check = TkRadioButton.new(@options_window) do
text 'Nein'
variable autostart
value 'nein'
background 'royalblue'
activebackground 'royalblue'
font TkFont.new('Comic 9 bold')
anchor 'w'
cursor "hand2"
place 'x' => 115, 'y' => 260
end
Win32::Registry::HKEY_LOCAL_MACHINE.open("Software\\Microsoft\\Windows\\CurrentVersion\\Run") do |obj|
if obj.keys.include?("Bibel-Box")
autostart_ja_check.select
else
autostart_nein_check.select
end
end
bt = TkButton.new(@options_window) do
height 1
width 5
place 'x' => 75, 'y' => 310
text "OK"
font TkFont.new('Comic 12 bold')
background 'blue'
activebackground 'royalblue'
foreground 'white'
end
bt.bind('ButtonRelease-1') do
if autostart == "ja"
Win32::Registry::HKEY_LOCAL_MACHINE.open("Software\\Microsoft\\Windows\\CurrentVersion\\Run") do |obj|
if obj.keys.include?("Bibel-Box")
else
obj["Bibel-Box"] = RUBYSCRIPT2EXE.executable.gsub("/","\\")
end
end
elsif autostart == "nein"
Win32::Registry::HKEY_LOCAL_MACHINE.open("Software\\Microsoft\\Windows\\CurrentVersion\\Run") do |obj|
if obj.keys.include?("Bibel-Box")
obj.delete("Bibel-Box")
else
end
end
end
Configuration.set_bibel(current_bibel)
@options_window.withdraw
@otions_already_started = true
@mom_bibel.configure("text", "Bibelausgabe: #{current_bibel}")
@window.focus(true)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment