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:

VBS Script for Multi Posts


Recommended Posts

Ok you need ot do alt c and bring up chook mcamvb. Here you will see a place to load a script or run a script or you can also map a toolbar to the VB script and run it that way.

 

Now a question for you did you go the FTP and get the ZIP out of the VB folder there is a very good explaintion of things to do and to watch for when using the multipost and the VB scripts.

 

HTH

Link to comment
Share on other sites

I would also look ofr the multi post. The Vb part of it was for folder selection to put the files in the right place as well as some other functions if memeory serves me correct. You can set up the multi post you can do liek your post for one post then your set ot html set-up sheet as your others and if you had a txt that did soemthing it could be your third. Then when you post you get a post file a set-up sheet then a txt file like report or something you hsve developed for any additional information.

 

Glad if I can help anyone and that is reward enough for me. biggrin.gifbiggrin.gif

Link to comment
Share on other sites

quote:

he Box is not checked. I have it posting for 7 diffrent machines but it doesn't pull all 7 up in program editor. If that makes since.(sp)


Check your posts to see if they have the variable bug1 set to anything other than 0, if so make them 0 to suppress the editor.

 

code:

# --------------------------------------------------------------------------

# Debugging and program switches

# --------------------------------------------------------------------------

fastmode : 1 #Posting speed optimizition

bug1 : 2 #0=No display, 1=Generic list box, 2=Editor

Link to comment
Share on other sites

This is what my Bug1 line says

# --------------------------------------------------------------------------

# DEBUG/PROGRAM SWITCHES, debugging and program switches

# --------------------------------------------------------------------------

bug1 : 2 # 1=Output post to screen, 2=output leader to screen

do I need to add

 

#0=No display

Link to comment
Share on other sites

can I put this in as questions

' ////////////////////

' Sub Declaration

' ////////////////////

Sub Main()

 

On Error Resume Next

 

Do 'ask until a real company name is entered

companyname=AskString("company Name?")

Loop While companyname="company Name?" Or companyname="((ESC))" Or companyname=""

 

Do 'ask until a real program number is used

Program=AskString("PI number?")

Loop While Program="PI number?" Or Program="" Or Program="((ESC))"

 

 

then use this

 

'///////////////// My Constants /////////////////

Public Const DEF_FIRST_POST = "OP_KH.pst"

Public Const DEF_CNC_1 = "C:'Company Name'PI numberNC CodeOP"

Public Const DEF_SECOND_POST = "550_KH.PST"

Public Const DEF_CNC_2 = "C:'Company Name'PI numberNC Code550"

Public Const DEF_THIRD_POST = "1000_KH.PST"

Public Const DEF_CNC_3 = "C:'Company Name'PI numberNC Code1000"

Public Const DEF_FOURTH_POST = "Okuma_KH.PST"

Public Const DEF_CNC_4 = "C:'Company Name'PI numberNC CodeOkuma"

Public Const DEF_FIFTH_POST = "V30_KH.PST"

Public Const DEF_CNC_5 = "C:'Company Name'PI numberNC CodeV30"

Public Const DEF_SIXTH_POST = "V40_KH.PST"

Public Const DEF_CNC_6 = "C:'Company Name'PI numberNC CodeV40"

Public Const DEF_SEVENTH_POST = "760_KH.PST"

Public Const DEF_CNC_7 = "C:'Company Name'PI numberNC Code760"

 

to send it to the right folder

 

Got the questions from setup sheets.vbs off FTP site.

 

Kyle

Link to comment
Share on other sites

You cannot modify constant variables (variables declared with the 'Const' keyword). Instead, one way would be to create two seven-element arrays to hold the company names and pi numbers and that you read in your two DO loops (you'll need variables for index counters that you'll have to increment in each iterations) like this:

 

code:

Dim arrCompanyName(7)

Dim arrPiNumber(7)

Then you'll have to assemble your seven paths, after you've prompted for company name and pi number, something like this:

 

code:

Dim strCNC1

Dim strCNC2

' and so on...

Dim strCNC7

 

' assemble paths

strCNC1 = "C:" & arrCompanyName(0) & "" & arrPiNumber(0) & "NC CodeOP"

strCNC2 = "C:" & arrCompanyName(1) & "" & arrPiNumber(1) & "NC Code550"

' and so on...

There's more efficient ways to write this and sorry for the lack of complete code but it's quite early in the morning right now wink.gif I'll finish it up when I'm in the office.

Link to comment
Share on other sites

This is what I have so far. I'm sending at break time.so I have to hurry

 

'////////////////////////////////////////////////////////////////////////////////

'//

'// Author: Mick George [email protected]

'// Date: 16/09/2003 12:58 PM

'// File Name: MULTIPOST.VBS

'//

'// Description: Posts drawing to two defined posts

'//

'// Comments:

'//

'////////////////////////////////////////////////////////////////////////////////

 

 

'///////////////// My Constants /////////////////

Public Const DEF_FIRST_POST = "OP_KH.pst"

Public Const DEF_SECOND_POST = "550_KH.PST"

Public Const DEF_THIRD_POST = "1000_KH.PST"

Public Const DEF_FOURTH_POST = "Okuma_KH.PST"

Public Const DEF_FIFTH_POST = "V30_KH.PST"

Public Const DEF_SIXTH_POST = "V40_KH.PST"

Public Const DEF_SEVENTH_POST = "760_KH.PST"

 

 

'///////////////// My Global Variables //////////

 

 

' -- Start Script

Call Main()

 

 

' ////////////////////

' Sub Declaration

' ////////////////////

Sub Main()

 

On Error Resume Next

 

Do 'ask until a real company name is entered

companyname=AskString("Company Name?")

Loop While companyname="Company Name?" Or companyname="((ESC))" Or companyname=""

 

Do 'ask until a real program number is used

Program=AskString("Part number?")

Loop While Program="Part number?" Or Program="" Or Program="((ESC))"

 

 

Dim arrCompanyName(7)

 

Dim arrProgram(7)

 

Dim strCNC_1

Dim strCNC_2

Dim strCNC_3

Dim strCNC_4

Dim strCNC_5

Dim strCNC_6

Dim strCNC_7

 

'assemmble paths

strCNC_1 = "C:" & arrCompanyName(7) & "" & arrProgram(7) & "NC CodeOP"

strCNC_2 = "C:" & arrCompanyName(7) & "" & arrProgram(7) & "NC Code550"

strCNC_3 = "C:" & arrCompanyName(7) & "" & arrProgram(7) & "NC Code1000"

strCNC_4 = "C:" & arrCompanyName(7) & "" & arrProgram(7) & "NC CodeOkuma"

strCNC_5 = "C:" & arrCompanyName(7) & "" & arrProgram(7) & "NC CodeV30"

strCNC_6 = "C:" & arrCompanyName(7) & "" & arrProgram(7) & "NC CodeV40"

strCNC_7 = "C:" & arrCompanyName(7) & "" & arrProgram(7) & "NC Code760"

 

Dim strCurrentPost

 

' -- Check for drawing

If IsDrawing Then

 

' -- Store current post

strCurrentPost = GetPostName

 

' -- Set first post as current post

Call SetPostName(DEF_FIRST_POST)

 

' -- Post it

Call RunPostAll(CNC_1, False)

 

' -- Set second post as current post

Call SetPostName(DEF_SECOND_POST)

 

' -- Post it

Call RunPostAll(CNC_2, False)

 

' -- Set third post as current post

Call SetPostName(DEF_THIRD_POST)

 

' -- Post it

Call RunPostAll(CNC_3, False)

 

' -- Set fourth post as current post

Call SetPostName(DEF_FOURTH_POST)

 

' -- Post it

Call RunPostAll(CNC_4, False)

 

' -- Set fifth post as current post

Call SetPostName(DEF_FIFTH_POST)

 

' -- Post it

Call RunPostAll(CNC_5, False)

 

' -- Set sixth post as current post

Call SetPostName(DEF_SIXTH_POST)

 

' -- Post it

Call RunPostAll(CNC_6, False)

 

' -- Set seventh post as current post

Call SetPostName(DEF_SEVENTH_POST)

 

' -- Post it

Call RunPostAll(CNC_7, False)

 

 

 

 

' -- Set mc back to original post

Call SetPostName(strCurrentPost)

 

End If

 

 

End Sub

 

' ////////////////////

' Function Declaration

' ////////////////////

 

Function IsDrawing()

 

Dim Ret

 

Ret = StartDBSearch(mc_alive, -1)

 

IsDrawing = Ret

 

End Function

 

 

It almost works. it gets to c:regaltest

 

but stops there and only posts the 760

I think it it just puts one post on top ov another

and ends up with the 760 because it is the last post banghead.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...