If Toolbar is true make it false
-
ok will do thanks dan, sorry just new to forums, well not new joined 2 years ago but not used to it.
-
need to be 3 lines, not all on 1 line, or else you must finish statements with a semi-colon ( ; ).
-
in the console (ver 7
if UI.toolbar_visible?('GettingStarted'); Sketchup.send_action(21992); end
with the toolbar off, does nothing and returns nil.
with the toolbar visible, it hides the toolbar and returns true.
-
great that worked in sketchup 7, however when I put it inside of my .rb file it dosnt work. to test it out could I simply just add a new .rb file inside of the plugins folder and inside there put:
status = if UI.toolbar_visible?('GettingStarted') Sketchup.send_action(21992) end
-
ok I have got:
if UI.toolbar_visible?('GettingStarted'); Sketchup.send_action(21992); end
working in my v6 through the ruby console however how come when I put it inside of my .rb file it does not work?
could there be errors?
-
@simonstaton said:
to test it out could I simply just add a new .rb file inside of the plugins folder and inside there put:
status = if UI.toolbar_visible?('GettingStarted') > Sketchup.send_action(21992) > end
Yes I put things like this in a rb called "!Defaults.rb"
The exclamation makes it load before alpha characters because of the position of ! in the ASCII set.Also you don't need "status =" if you will not use the status reference.
-
-
I see so how would I load up a new .rb file to have this in, is it as simple as making a file called hidetool.rb then inside there putting
!Defaults.rb if UI.toolbar_visible?('GettingStarted') Sketchup.send_action(21992) end
-
@simonstaton said:
..., is it as simple as making a file called hidetool.rb then inside there putting
No.. name the FILE --> !Defaults.rb
# defaults for Sketchup Startup begin # hide the GettingStarted toolbar Sketchup.send_action(21992) if UI.toolbar_visible?('GettingStarted') end
P.S. the send action line is all 1 line in the above example.
-
@dan rathbun said:
@simonstaton said:
..., is it as simple as making a file called hidetool.rb then inside there putting
No.. name the FILE --> !Defaults.rb
> # defaults for Sketchup Startup > begin > # hide the GettingStarted toolbar > Sketchup.send_action(21992) if UI.toolbar_visible?('GettingStarted') > end
P.S. the send action line is all 1 line in the above example.
legend that seems to be working however each time I load sketchup it seems to toggle it on and off, so the first time I load it it turns it off then I close and reopen then its turned on.
-
Close sketchup.
Rename Plugins folder -> xPlugins
make a new Plugins folder
copy the !Defaults.rb file into the new folder
Restart Sketchupif it works, some other file is causing problems
if it doesn't work, then it's a ver 6 bug(when done restore your folders to before.)
Your only alternate then would be a Windows System call using Win32API.so
That requires a knowledge of C language and the MS Windows API. -
Ok, neither of the methods worked I also tried it using v7 and its still not working.
it is defiantly doing something as when all the plugins are disabled it will disable the toolbar then on the next reopen the toolbar will open so it just seems to be toggling it :s
-
Why are you trying to turn on/off the user's toolbar in the first place?
-
it is so that the user can see only my toolbar which is explained when they download, what is so bloody confusing is that when I put the event:
UI.set_toolbar_visible("GettingStarted", false)
inside of a toolbars tool event it works fine and hides it however when I put it lose inside the .rb file nothing happens!
this is driving me crazy I might just leave it as they have to click a button on my toolbar to hide it.
Simon
-
Maybe the toolbars aren't accessible when the .rb loads... ?
Timed delay? -
I think you are right! if its working from the ruby console and its working on the toolbar and its not working on load it must be because the toolbar is false until it has loaded.
anyway to add a delay onto the .rb file and have it only run once sketchup is fully loaded?
-
UI.start_timer
http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#start_timerNote that you can only use whole seconds with the timer.
-
excellent, works like a dream thanks dude. I can now finally say SOLVED
now I know this isnt related to my initial question however you guys know your stuff and I dont want to go making yet another topic. is there anyway to set a variable in ruby like you can in javascript.
in my toolbar I have two tools that rely on each other, a compress tool and a checkout tool before you checkout you need to compress.
is there anyway that only my tools even I can have it so that when you click compress it sets a variable like:
compress = trueand my default have compress = false then on my checkout tool have:
if (compress = true){
event
}
else {
alert
} -
Use
if compress {...
or
if compress == true {...
to test if compress IS true
BUT NOT
if compress = true {...
Which will set compress to true and therefore always return true ?
= sets a variable to a value
== compares two values -
Assuming you have wrapped your code in a module, use an instance variable:
@compressed
.http://www.techotopia.com/index.php/Understanding_Ruby_Variables
http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Variables_and_Constants
Advertisement