Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

A TSR VB-script ?


Recommended Posts

Hi , All.

 

First of all I want to say many thanks to Bryan314, Mick G. and Rekd that contributed to creation of such nice VBscript that I use much

cheers.gifcheers.gifcheers.gifcheers.gif

But I want it to do more- to work like autosave in stand-alone mode :

To specify to make save say every 20 minutes in auto mode without my interferience like a sorta TSR .

 

Is it possible?

 

Iskander teh never having enough ! smile.gif

Link to comment
Share on other sites

If Mastercam was developed with COM in mind, life would be great. You'd be able to, from any COM capable dev environment (MS Visual C++, MS VB, Borland Delphi, Borland C++ Builder, VBS, etc), create a Mastercam instance, create a new document/connect to an existing one (I could say 'open an existing one' but COM is client/server and some folks are picky) and do what you like with it. Cross your fingers that X has this in mind.

 

From a VBS, you could perhaps modify the script so that it "goes to sleep". To do so from VBS, you would use Windows Script's Sleep() function like this:

 

code:

Public Const SNOOZE_TIME = 1200000 ' 20 minutes (in milliseconds)

 

' go to sleep

WScript.Sleep SNOOZE_TIME

If you want to modify the script in question, simply rename the Main() subroutine to something like, say, AutoSave(). Then create a new Main() subroutine, create an infinite loop (and a way to escape so that it's not all that infinite rolleyes.gif ) and have it call AutoSave() and then sleep. It's cheesy, I know, but just an untested idea that popped into my head wink.gif Time isn't on my side, so I don't have a chance to try it out. If VBS scripts don't run in their own thread, this will freeze Mastercam. Should this idea work, I'd be surprised biggrin.gif The COM way would be ideal since it's event-driven (Hypothetical Ex: when a onDocUnload occurs, end AutoSave()).

Link to comment
Share on other sites

I haven't used the sleep function. I can imagine it will not allow normal interaction with MC while it's running, and even if it did, what would happen if you were crunching numbers and it 'woke up' ? System hang/crash, loss of toolpath etc.

 

It is a nice thought, and I'll try it if I get time today. If someone else has tried, please share the results. biggrin.gif

 

'Rekd teh where there's a will, there's a bill

Link to comment
Share on other sites

quote:

I thougt about a bit of hacking (oops,sorry!)


Hacking = good

Cracking = bad

 

wink.gif

 

quote:

if it is possible to substitute the regular autosave procedure with some dll ?


Unfortunately, no. Well, I shouldn't say that because if you know your way around a hex editor, anything is possible. Mind you, if you modified any of Mastercam's program files, I'm sure that CNC Software wouldn't be pleased to hear about it, obviously.

 

The problem lies in the fact that you'd need to know the entry point into the main EXE from the DLL. From C-Hooks, we're given an entry point, but it only allows C-Hooks a certain "space" to work in and not free reign.

 

quote:

I can imagine it will not allow normal interaction with MC while it's running, and even if it did, what would happen if you were crunching numbers and it 'woke up' ? System hang/crash, loss of toolpath etc.

Ohhh yeah! wink.gif Hence the need for good escapes (which would be insane the way it is now) or COM. Bah, I'll get off my COM soap box now cheers.gif

Link to comment
Share on other sites

quote:

I thougt about a bit of hacking (oops,sorry!)

if it is possible to substitute the regular autosave procedure with some dll ?


Why hacking? You can write a resident chook which does the job.

Either the chook does the job itself or it acts as a loader which loads every 20 minutes the script. wink.gif

 

m_open()

{

create a timer

}

 

m_close()

{

delete the timer

}

 

timer_proc()

{

run a script or chook

}

 

[ 09-03-2003, 09:56 AM: Message edited by: Gismo ]

Link to comment
Share on other sites

Gismo, good point. I forgot that they added m_open(), m_close() and m_enter().

 

quote:

Bulliness

Not that I follow the rest of the thread but what is COM?


COM (aka: Component Object Model) is a component-based language-independant programming standard. Essentially, an app would be divided into separate components that can be used by other apps. In that case, a third-party app could use all of its own routines and functions but at the same time be able to communicate with the "server" (in this case, Mastercam) through its exposed components. The third-part app could be written i nany language that is COM-aware (Ex: Microsoft Visual C++ is COM-aware; COBOL is not). It's a lot kewler than it sounds wink.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...