This works on my mac,
out_name = UI.savepanel('Location', '' , "#{File.basename(Sketchup.active_model.path).sub('.skp','.txt')}")
if out_name
if File.extname(out_name).downcase != ".txt" # if the user erase the extension, rewrite it!
out_name += ".txt"
end
File.open(out_name , 'w') { |file|
file.puts(%Q["blabla"])
}
end
in my Add_Note extension, I use this...
module JcB
module Add_Note
#----------------------------------------------------------------------------------------#
def self.note2self
mod = Sketchup.active_model
mod_path = mod.path
if mod_path.empty?
Sketchup.send_action('saveDocument;' )
UI.messagebox("Save with name and Try Again")
else
time = Time.now
txt_path = mod_path.sub('.skp', '.txt')
File.open(txt_path, "a+") { |file| file.puts("\n" + time.ctime) }
UI.openURL('file;///' + txt_path)
return 'note2self done'
end # mod_path.empty?
end # note2self
#----------------------------------------------------------------------------------------#
end # Add_Note
end # JcB
JcB;;Add_Note.note2self
john