[REQ] Plugin "open file"
-
@fredo6 said:
Bep,
Actually, the main difficulty is to decide on the icons displayed in the toolbar.
It could be just:
- colors
- Letters, like A, B, C, .... or numbers
- thumbnail of files (more difficult, and not differentiating since rather based on file type)
- a set of predefined icons
In any case, someone has to design these icons.
Fredo
Fredo, i understand and foresaw the difficulty about the icons your explaining.
That is why i asked for a not to fancy script in the first place.
Sam's script almost worked for me, if only it was not limited to Sketchup files.
"I could modify my own button icon, and change the filepath in the ruby script to the file i need to open."
If i needed another tool button to launch another file, i would just copy and rename the ruby script, and put other icons and an other filepath in it.
I could than if i wanted the tool buttons in one toolbar, make a custom toolbar with these buttons placed together in it.Bep
-
@bep said:
@fredo6 said:
Bep,
Actually, the main difficulty is to decide on the icons displayed in the toolbar.
It could be just:
- colors
- Letters, like A, B, C, .... or numbers
- thumbnail of files (more difficult, and not differentiating since rather based on file type)
- a set of predefined icons
In any case, someone has to design these icons.
Fredo
Fredo, i understand and foresaw the difficulty about the icons your explaining.
That is why i asked for a not to fancy script in the first place.
Sam's script almost worked for me, if only it was not limited to Sketchup files.
"I could modify my own button icon, and change the filepath in the ruby script to the file i need to open."
If i needed another tool button to launch another file, i would just copy and rename the ruby script, and put other icons and an other filepath in it.
I could than if i wanted the tool buttons in one toolbar, make a custom toolbar with these buttons placed together in it.Bep
UI.openURL ("") is the code to open any file
this is an example that shows an image on my screen at ""C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\logo.jpg""
just change to the file you need to open
the icon file is in the plugins folder; in that case MCT_LRO.jpg
you can change that tootb = UI::Toolbar.new("Toolbar Name") cmd = UI::Command.new("Plugin Name") { Sketchup.open_file UI.openURL("C:\\Users\\glro\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Plugins\\MTX\\logo.jpg") } cmd.tooltip = "Plugin Name" cmd.status_bar_text = "Plugin Name" cmd.large_icon = File.join(File.dirname(__FILE__), "MCT_LRO.png")
cmd.small_icon = File.join(File.dirname(FILE), "MCT_LRO.png")
tb.add_item(cmd) tb.show unless tb.get_last_state == 0
-
this is a better version, based on TIG's code in the plugin MIRROR to add a button:
replace
C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\notice_metrix_2016_bd.pdf
by the path to your file
replace the name of module and definition also, and the name of the png file
` require "sketchup"
module MTX
def MTX.notice
UI.openURL("C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\notice_metrix_2016_bd.pdf")
end
endunless file_loaded?(File.basename(FILE))###
UI.menu("Plugins").add_item("MTX_Notice Metrix"){MTX.notice}Context menu
#=begin
UI.add_context_menu_handler do |menu|### v3.5 TIGif Sketchup.active_model.selection[0]
#menu.add_separator menu.add_item("Notice Metrix"){Sketchup.active_model.select_tool(MTX.notice)}
end#if
end#do menu###
#=endToolbar - only adds the toolbar IF there's an icon png with it ###v3.2
png=File.join(File.dirname(FILE),"MTX_notice_Metrix.png")
if FileTest.exist?(png)
tb=UI::Toolbar.new("Notice Metrix")
cmd=UI::Command.new("MI"){Sketchup.active_model.select_tool(MTX.notice)}
cmd.large_icon=png
cmd.small_icon=png
cmd.tooltip="Notice Metrix"
cmd.status_bar_text="Notice Metrix: afficher..."
tb.add_item(cmd)
if tb.get_last_state==TB_NEVER_SHOWN
tb.show
elsif tb.get_last_state==TB_VISIBLE
tb.restore
end#if state
end#if toolbarend#if loaded
file_loaded(File.basename(FILE))` -
Rather bizarre request..
Why one won't just put any desired desktop shortcut instead? -
@rv1974 said:
Rather bizarre request..
Why one won't just put any desired desktop shortcut instead?maybe because when sketchup fills your screen entirely, you have to close or reduce the sketchup window to access the shortcut
if the shortcup is inside the sketchup window, you can access it directly
each clic matters...
-
@glro said:
@bep said:
@fredo6 said:
Bep,
Actually, the main difficulty is to decide on the icons displayed in the toolbar.
It could be just:
- colors
- Letters, like A, B, C, .... or numbers
- thumbnail of files (more difficult, and not differentiating since rather based on file type)
- a set of predefined icons
In any case, someone has to design these icons.
Fredo
Fredo, i understand and foresaw the difficulty about the icons your explaining.
That is why i asked for a not to fancy script in the first place.
Sam's script almost worked for me, if only it was not limited to Sketchup files.
"I could modify my own button icon, and change the filepath in the ruby script to the file i need to open."
If i needed another tool button to launch another file, i would just copy and rename the ruby script, and put other icons and an other filepath in it.
I could than if i wanted the tool buttons in one toolbar, make a custom toolbar with these buttons placed together in it.Bep
UI.openURL ("") is the code to open any file
this is an example that shows an image on my screen at ""C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\logo.jpg""
just change to the file you need to open
the icon file is in the plugins folder; in that case MCT_LRO.jpg
you can change that tootb = UI::Toolbar.new("Toolbar Name") cmd = UI::Command.new("Plugin Name") { Sketchup.open_file UI.openURL("C:\\Users\\glro\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Plugins\\MTX\\logo.jpg") } cmd.tooltip = "Plugin Name" cmd.status_bar_text = "Plugin Name" cmd.large_icon = File.join(File.dirname(__FILE__), "MCT_LRO.png")
cmd.small_icon = File.join(File.dirname(FILE), "MCT_LRO.png")
tb.add_item(cmd) tb.show unless tb.get_last_state == 0
Thank you very much Glro,
I got the script opening a file just as i requested.
However the file will pup up in front of the Sketchup-window, and than in a split second hides behind it.
I have to click the file icon on the taskbar or reach for the file-window behind the Sketchup-window, to click it, and to get it in front of the Sketchup-window again.I hope i can figure out how the fix this last bit.
Bep
-
@rv1974 said:
Rather bizarre request..
Why one won't just put any desired desktop shortcut instead?Hello rv1974,
do not judge too quickly.
In my case its not that bizarre.
The tool-button will be part of a toolbar that is used in a repetitive process.
One part of the process is opening office file's to copy and paste from and to.
All parts of the process are in one toolbar, in the correct sequence from left to right.
Setting up these machines with all the right files and ruby's in one .rbz is the goal for meantime.
The ultimate goal however is to try to automate the whole process.(taking small steps)Bep
-
Some years ago I modified a little script file so it would open the calculator program in windows. It could be modified to open any program I expect. And looking at the thread, I suppose you could add a toolbar although I would prefer a keyboard shortcut.
-
@dave r said:
Some years ago I modified a little script file so it would open the calculator program in windows. It could be modified to open any program I expect. And looking at the thread, I suppose you could add a toolbar although I would prefer a keyboard shortcut.
Dave, i remember your calc.rb
imho keyboard shortcuts would be less efficient, be course i would have to install them on every machine next to Sketchup and all the necessary ruby's.
Than i would have put sticky notes on every PC-machine with the keybord -shortcuts and instruct all persons working with these machine's.
The way i see it, Sketchup with this toolbar could work as a sort off switchboard to all the necessary files and programs.
Bep -
Didn't Sahi have a plugin to open a folder/file location?
-
@bep said:
...
I got the script opening a file just as i requested.However the file will pup up in front of the Sketchup-window, and than in a split second hides behind it.
I have to click the file icon on the taskbar or reach for the file-window behind the Sketchup-window, to click it, and to get it in front of the Sketchup-window again.I hope i can figure out how the fix this last bit.
Bep
on my computer, the opened file stays on top on the sketchup window
-
@rv1974 said:
@glro said:
@rv1974 said:
Rather bizarre request..
Why one won't just put any desired desktop shortcut instead?maybe because when sketchup fills your screen entirely, you have to close or reduce the sketchup window to access the shortcut
if the shortcup is inside the sketchup window, you can access it directly
each clic matters...
Just ONE Win+D (Alt+Tab if it's open) hit! And thisrequires a dedicated plugin??
And to pin a File or Folder to the Windows 7 Taskbar won't ease solve your problem either?
the "dedicated plugin" is such an easy one..no big deal
and from what i understand, it is the beginning of something elsei just tried to help
-
@glro said:
@rv1974 said:
Rather bizarre request..
Why one won't just put any desired desktop shortcut instead?maybe because when sketchup fills your screen entirely, you have to close or reduce the sketchup window to access the shortcut
if the shortcup is inside the sketchup window, you can access it directly
each clic matters...
Just ONE Win+D (Alt+Tab if it's open) hit! And thisrequires a dedicated plugin??
And to pin a File or Folder to the Windows 7 Taskbar won't solve your problem either?
Advertisement