you need a few more def's and wrap it all up in a class.
class MyClass #replace with your preferred name
def gui()
#...code
log = UI;;Command.new("Load log file") { load_log_file() }
#...code
end
def load_log_file()
@logPath = UI.openpanel("Open Log File")
if @logPath
x = File.join(@logPath.split('\\'))
readLog(File.join(@logPath.split('\\')))
end
end
#... other defs
end #class MyClass