Meaningful Shortcut Keys Listing.
 1-18  19-38  39-50

Previous
Next
 From:  BurrMan
2134.19 In reply to 2134.17 
pardon! Answered my own question. Yes it works this way with no additional code.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2134.20 In reply to 2134.17 
Hi Burr,

> If you just put "script:var dir = moi.view.lightDirection; if ( dir.x == 1
> && dir.y == (.....continued....)" into a file named "fred.js" does it run
> by calling that file or does the js file need "other" properly formatted
> syntax to be functional?

To use the separate .js file style, you just need to remove the script: label at the front there.

That initial script: label is something special for the shortcut key editor to clarify whether the stuff typed there is an inline script or the name of a command. Actually there is a new experimental thing in the current v2 beta where you can eliminate that label if you want even from inline scripts because it will assume that the contents are inline script if it does not match a command name and does not end in a script file extension (like .js). But the script: label is required for inline scripts to work with version 1.0 though.

Also when you have the script in the separate .js file you don't need to jam it all on a single line like the inline script, and you can use an #include "library_filename.js" directive in the .js file to combine other script libraries into the current script file when it is executed. (the #include does not work with inline scripts, only with separate-file scripts).

Other than that all the syntax and stuff that is available to it is all the same as the inline script.


Then to use the separate script file there are 2 options - you can either place the full path to the script file in the Command part of the keyboard shortcut, like:
c:\scripts\MyScript.js or you can put just the file name itself, like: MyScript.js in which case it will look in a \scripts subfolder inside of MoI's main installation folder for it. This folder is not created by default, just create it if you want to place scripts there.

But you may want to use the full path method because then you won't need to move files around when you get new betas, etc...


Oh yeah one other thing is that it should be theoretically possible to make a script using the VBScript language instead of JavaScript, if you use a .vbs file extension for the script file instead of .js but I have not really tested that. Inline scripts are assumed to be JavaScript.


And actually come to think of it, you probably do not need to even remove that script: label at the front of the content for the separate file method, because it will actually be parsed by the script parser as a label and is legal JavaScript syntax I think. But you would normally remove it.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  steve (STEEVE)
2134.21 In reply to 2134.19 
That's a useful discovery you've made, BurrMan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Brian (BWTR)
2134.22 In reply to 2134.20 
Michael/Burr

You are talking a foreign language to me in those last posts.
For me, lifes too short! (It's bad enough that the computer wants to use US spelling in place of English!!)

Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
2134.23 In reply to 2134.20 
>>>And actually come to think of it, you probably do not need to even remove that script: label at the front of the content for the separate file method, because it will actually be parsed by the script parser as a label and is legal JavaScript syntax I think. But you would normally remove it.>>>

I found most of it worked without change, however, one script which was the "keep construction lines" script, didnt work. The "remove kept construction lines" worked yet I had to use petr's script with all the other syntax to keep construction lines (but that is what I'm after anyway! The friendly name thing for brian.)

I'm always trying to confuse him!

Coming back with a post for Brian in a minute.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
2134.24 In reply to 2134.23 
Here's a file for you brian.

What is in this zip are all the scripts from the "custom" shortcuts file I sent you awhile back made into js files for moi to read. A breif description of each script will jog your memory on what they do. The names are anything you want them to be, I just tried to keep them simple and descriptive for you to know what they are before you rename them.

So for instance solids.js is the script for selecting any solids. You could rename this to "jim.js" if thats what you want to call it, place it in a folder in your moi directory named scripts and assign any shortcut key to "jim.js" that you want.

It's a way for you to get the "friendly name" thing you want.

Here is a video of how it is done so you can do it to any of the other "long scripts" that you want a friendly name for.

http://www.exeink.com/caps/update4b.htm

Keep these around as when a new beta release comes out, you'll need to copy these into it's scripts folder also to go along with your shortcuts you set up for them.

Let me know if it's just to much for you or if you want clarification on anything else.
Rest assured that when the flux of beta releasing is over, a solution to acheive what you want will be easy.

Burr

EDITED: 19 Jun 2012 by BURRMAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2134.25 In reply to 2134.23 
Hi Burr,

> I found most of it worked without change, however, one script
> which was the "keep construction lines" script, didnt work.

I gave that one a try in a separate .js file, and it seemed to work ok for me over here, even including the script: at the start...

The ones that will be a bit different are the ones that are not inline script but instead the name of a custom command. Like for example in addition to the "keep construction lines" inline script (http://kyticka.webzdarma.cz/3d/moi/#KeepCLine), there is also a construction lines command (http://moi3d.com/forum/index.php?webtag=MOI&msg=1029.1).

To trigger that custom command one, you would have the command name in the shortcut keys, it would say something like "ConstructionLine" in the shortcut key instead of "script:moi.xxx.yy.zzz etc... "

You can't move a command name into a separate .js file, only actual script code.

Not sure if that is the problem you ran into?

Let me know if you need more details!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2134.26 In reply to 2134.24 
Very cool Burr!

Brian - just to clarify - Burr has converted those scripts that you don't like to see into separate .js files.

That will allow you to use a more simple name (the name of the .js file) inside of the shortcut key editor like you were asking for, rather than seeing the code directly in there.

Thanks Burr!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
2134.27 In reply to 2134.25 
I understand.

For some reason the "keep construction lines" inline script works for me if I use moi's shortcut editor, but if I just place it in a js file, it doesnt work. I'm still going to try to remove some things as per your post a bit ago, but there really is no need to try and figure this out as I also have petr's command of the same which works fine.
I'll post back if tinkering produces any answer. All the others worked....It's just this one???
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2134.28 In reply to 2134.27 
Hi Burr, can you please post the script that doesn't work here so I can check it out? Maybe there is a bug in there or something, it may be good to know why that one is not the same.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Brian (BWTR)
2134.29 In reply to 2134.27 
Is it any wonder that I LOVE the MoI users!

Burr/Michael----
allmost speachless in appreciation.

Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
2134.30 In reply to 2134.28 
Its the one from the petr page. I tried copying it from many places to make sure.

It looks like this:

script:moi.geometryDatabase.getObjects().getConstructionLines().setProperty( "isTemporary", false );

I just put it in a text file like all the rest and it deletes the construction lines.

Heres a file also. If you make a shortcut to this "command" it fails.

EDITED: 19 Jun 2012 by BURRMAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2134.31 In reply to 2134.30 
Hi Burr - strange - I tested your exact same testlines.js file over here and it is working for me...

Maybe double check what your shortcut key definition is for that one, are you possibly missing the .js file extension or something on that one particular shortcut key?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
2134.32 In reply to 2134.31 
I put no extenion in moi. So if I create a file called test, it kills the selected command ie; if I select line tool and press shortcut, line tool exits! If I add extension to command, I get error.



EDITED: 19 Jun 2012 by BURRMAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  steve (STEEVE)
2134.33 In reply to 2134.32 
Very nice Burr, this will be very useful :)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
2134.34 In reply to 2134.31 
I pretty much did, redid, checked and looked. Tried to remove the script tag. Tried to add the var gd that the "remove construction lines" script uses with no avail. Some kind of anomoly on "MY" system.

Just to recap, it works if I add it as inline to the command of the shortcut editor. All the others work also as js files. Just that one acts up.

But since it is not re-creatable and it's not an issue for me lets not waste your time.

If others do this and experience issues, we can re-visit it and pursue the answer.

Thanks again,
Burr
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2134.35 In reply to 2134.32 
Hi Burr - I see. But it looks like you're trying to put those scripts inside the \commands folder.

Running those as commands will basically work for many cases, but commands get some special processing and cannot currently be nested. If you try to run a command while an existing one is running, the running command is canceled and then the new command is started. That's what you are seeing in this construction line case.

To enable something to run without canceling the current command, it needs to be run as an "immediate script" instead of as a "command".

To do that, make a new folder called \scripts that is underneath the main MoI installation folder (so it is a sibling to \commands). Then put your testlines.js file into that \scripts folder (not \commands !), then put testlines.js including the file .js file extension part into the keyboard shortcut, and then it should work for you.

That will run the contents of that file as an immediate script instead of running it as a command.

Many of the things that you can set up as keyboard shortcuts that are inline scripts (with the script: prefix) can normally be run while a command is going, so you'll probably want to have most of the things like this in the \scripts folder instead of \commands.

Check out the message earlier in this thread:
http://moi3d.com/forum/index.php?webtag=MOI&msg=2134.20 again for some of the details about the \scripts folder.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
2134.36 In reply to 2134.35 
That was it... Thanks!

Must make a new video for brian!

I'll be back.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Brian (BWTR)
2134.37 In reply to 2134.36 
Several posts that made me cry---what is that all about! (Double Dutch was the word in my times!)

Burr, look forward to the new "Brian" movie mate.
Jeeze, I am so spoilt!

Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
2134.38 In reply to 2134.37 
Here's the updated vid that reflects michaels input.

http://www.exeink.com/caps/update4b.htm

Also here is an updated file to download which unzips into a scripts folder to go with the video.

I'll go back and change the old post also.

Again, let me know if you need any help Brian.

Burr

EDITED: 19 Jun 2012 by BURRMAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-18  19-38  39-50