hexagon logo

Help: Puttext method Problem

Hi,

Since our operators dont seem to be able to enter SNs correctly, I'm trying to program a dropdown menu fed with a textfile that contains all the SNs.
The Dropdown is made in Basic and reads out everything in the textfile...
So far so good...
When I try to transfer the data to PCDMIS, it doesnt work anymore (most probably because I'm doing something wrong)...


This is my code inside PCDMIS:

ZUWEISEN/DROP_SEL=""
CS1 =SKRIPT/DATEINAME= U:\LAURENT DESPINEUX\PC DMIS\AUTOMATED\SUPERDYNAMIC\DROPDOWN HYPERDYNAMIC (FROM FILE).BAS
FUNKTION/Main,EINBLENDEN=JA,,
STARTSKRIPT/
ZUWEISEN/DROP_SEL=0
ENDESKRIPT/
KOMMENTAR/PROT,
"" + DROP_SEL​



Dim PCDDmisApp As Object
Dim PCDDmisPart As Object
Dim PCDDmisCommands As Object
Dim PCDDmisCommand As Object
Dim DROP_SEL As String

Sub Main ()



Set PCDDmisApp = CreateObject("PCDLRN.Application")
Set PCDDmisPart = PCDDmisApp.ActivePartProgram
Set PCDDmisCommands = PCDDmisPart.Commands

Dim Command As Object

Let Count = "1"
Open "U:\Laurent Despineux\PC DMIS\Automated\Superdynamic\list.txt" For Input As #1
Do While Not EOF(1)
       Line Input #1, Textline
       Count = Count + 1
Loop
Close #1

Dim MyList$ (25)

Let C= "0"
Open "U:\LAURENT DESPINEUX\PC DMIS\AUTOMATED\SUPERDYNAMIC\list.txt" For Input As #1
Do While Not EOF(1)
       Line Input #1, Textline
               MyList(C) = LEFT(Textline, 10)
       C = C + 1
Loop
Close #1

Begin Dialog DialogName1 200,184, "Part Number Selection Dialog Box"
Text 10,10,88,22, "N auswählen:"
DropListBox 42,76,108,186, MyList$(), .DropList1$
CancelButton 42,108,40,12
OKButton 90,108,40,12
End Dialog


Dim Dlg1 As DialogName1

'       Dlg1.DropList1  =  0 this shows item (0) default In the window In the drop down list
'       You can change it To show Any item On top from Mylist()
Dlg1.DropList1  =  0

'       If cancel button is selected, Exit Sub
Button = Dialog(Dlg1)
If Button = 0 Then Exit Sub
  
Vari = Dlg1.DropList1
Set PCDDmisCommand = PCDDmisCommands.Add(ASSIGNMENT,True)
PCDDmisCommand.Marked = True
retval = PCDDmisCommand.PutText("DROP_SEL",DEST_EXPR,0)
retval = PCDDmisCommand.PutText(mylist$(Vari),SRC_EXPR,0)
MsgBox mylist$(Vari)
End Sub

​


If i'm putting a Value manually (for instance "12345") instead of the variable (mylist$(Vari)) then it's working...
Additional information: the "ZUWEISEN/DROP_SEL=0" contains the Value chosen in the dropbox when the script is finished... unluckily I cannot use it since when i check it's content with a usercomment, it is "0"
Any ideas?

Parents
  • Good day,

    * Cint(vSNRLine)
    please don't do that, because that will generate an error as soon as you have any character other than a number. You should always treat "serial numbers" as a string.
    - if at all then please like this: CStr(vSNRLine)

    * now to your second problem:
    if pcDMIS finds a character string that doesn't have a "..." then it thinks it's talking about a float or int.
    A conversion to this format is carried out internally.
    This conversion fails as soon as he finds a letter (therefore it is displayed in red because of the "SN")
    - if you want the character string to always be treated as a string also in pcDMIS you must put this in ".

    you only have to instruct your basic script to set the " additionally​.
    for example like this:
    retVal = PCDDmisCommand.PutText(Chr(34) + vSNRList(Dlg1.DropList1) + Chr(34), SRC_EXPR, 0)
    
  • Thank you!
    That's been the problem all along Smiley
    I did try to use numerical values only and it still didn't work, so i thought it had to be something else.
    I Didnt think it could be solved by just adding the "..." in Basic.
    That's way better then only beeing able to use numeric values.
Reply Children
No Data