Here is a Client Basic script which invokes the Protel ReportBOM process to generate a CSV file from the schematic. Then a call is made to an executable in order to process the CSV in order to generate a BOM report. It does not put anything back into the schematic, haven't figured that out yet. Anyway this might give you something to chew on.
Best regards, Duane Foster ' RunBom.bas - ClientBasic macro for Protel 99 SE ' Form BOM report with part numbers - text output style ' ' Schematic must be in 'windows file system' DDB format ' 'csv_gbn.exe' v3.2 and 'pcbparts.asc' must be in c:\program files\design explorer 99 SE\ Sub Main Dim b as Integer Dim l as Integer Dim Fname as String *255 Dim AFile as String Dim BFile as String ResetParameters AddStringParameter "DocumentType","SCH" AddStringParameter "Prompt"',"Select Schematic for BOM report" AddStringParameter "Dialog","ChooseDocument" RunProcess "Client:RunCommonDialog" GetIntegerParameter "Result", b If b Then GetStringParameter "FileName", Fname ' Msgbox Fname 'diagnostic ResetParameters AddStringParameter "DocumentName", Fname RunProcess "Sch:ReportBOM" ResetParameters RunProcess "Client:CloseDocument" SetCursorBusy ' Parse Filename string to get path b = InStr(1, Fname, "$RP") 'locate preceding field b = b + 4 'set first char of path l = InStr(1, Fname, "$RN") 'locate end of path l = l - b 'length of path AFile = Mid(Fname, b, l) 'fetch path name BFile = Mid(Fname, b, l) 'fetch path name for later use ' Parse Filename string to get schematic name b = InStr(1, Fname, "$ON") 'locate preceding field b = b + 4 'set first char of schematic name l = InStr(1, Fname, "$ID") 'locate end of schematic name l = l - b 'length of sch name AFile = AFile + "\" + Mid(Fname, b, l) 'fetch schematic name l = Len(AFile) AFile = Mid(AFile, 1, (l-3)) AFile = AFile + "sch" 'form lowercase extension for csv_gbn.exe ' Msgbox AFile 'diagnostic Open "C:\Program Files\Design Explorer 99 SE\bom_sch.tmp" For Output As #1 Write #1, AFile Close #1 ResetParameters RunApplication "C:\Program Files\Design Explorer 99 SE\csv_gbn.exe" ResetCursor ' Parse Filename string to get DDB name b = InStr(1, Fname, "$RN") 'locate preceding field b = b + 4 'set first char of DDB name l = InStr(1, Fname, "$OP") 'locate end of DDB name l = l - b 'length of DDB name BFile = BFile + "\" + Mid(Fname, b, l) 'fetch DDB name & add to path ' Form Bom Filename l = Len(AFile) AFile = Mid(AFile, 1, (l-4)) AFile = AFile + "_bom.txt" ' Msgbox BFile 'diagnostic ResetParameters AddStringParameter "FileName", BFile RunProcess "Client:OpenDocument" ResetParameters AddStringParameter "CreateNewDesign", "False" AddStringParameter "FileName", AFile RunProcess "Client:OpenDocument" ' this call has been a problem!!! Else Msgbox "you eeediot!!" End If End Sub '--------------------------------------------------------------------------- -----------} > -----Original Message----- > From: Aron Hoekstra [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, December 11, 2001 7:00 AM > To: Protel Developers Forum > Subject: [PDEV] newbie question > > > i'm new to this forum, so i'm not sure how many people are in > it or how much > help this will be. but since protel's online knowledge base > isn't working, > this seems like a good alternative. > > i'm new to protel macro development and i can't find any real good > documentation on Client Basic or any of it's proprietary functions and > properties. i need to do something that seems like it would be pretty > simple. we have a database of all our electrical parts, and > what i'd like > to do is this: > > I will put a button on the schematic menu that launches a > macro. the macro > will then send a custom program that i write (probably in VB) > the name of a > selected object in the schematic editor. my program will look > up our part > number in our database and send the data back to the macro. > Then, the macro > will then update the selected object with our part number. > > pretty simple and straight-forward right? so, where do i get > started? :) > > Thanks! > > Aron Hoekstra > Software Engineer > The Board Room, Inc. > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * To post a message: mailto:[EMAIL PROTECTED] * * To leave this list visit: * http://www.techservinc.com/protelusers/leave.html * * Contact the list manager: * mailto:[EMAIL PROTECTED] * * Forum Guidelines Rules: * http://www.techservinc.com/protelusers/forumrules.html * * Browse or Search previous postings: * http://firstname.lastname@example.org * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *