Message 1 of 2
Waiting Loop ?

Not applicable
06-27-2007
01:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HI
Long story short with 2008 we are no-longer using our in house erp program ans are moving into the "real" world so i have to fix up the code we use to send data to the new erp/mrp system.
Basically i have to send a text file from inventor to a "spooller" location which the erp system monitors if it detects a file in the location it processes the information in it and appends some information to it and saves it back to a folder on the local hard drive where i need Inventror to open it and read the new information back into the part / assembly files iProps. At the moment all the code is working except for the waiting loop where Inventor needs to wait and check if the file has been placed in the local folder. In testing this has taken anywhere betweem 1.9 seconds and almost 1 minute.
I need a way of having Inventor loop around checking for this file and then when it appears triggering the next section of code to strip the text file down etc. I want to do this without setting a wait for 60 seconds for the odd time that it does take this long. so ant help would be appreciated.
Daren
M90 84.26 XPSP2 4 GB
Dim oSAPDataFile As String
oSAPDataFile = Format(Time, "HH-MM-SS")
' Open file for output.
Open "C:\SAP Test Files\out\" & oSAPDataFile & ".txt" For Output As #1
'Set variables to pass to SAP
Dim oSAPDName As String
Dim oSAPDNameLen As String
oSAPDNameLen = Len(FileName.Text)
oSAPDName = Left(FileName.Text, oSAPDNameLen - 4)
' Write comma-delimited data.
Write #1, oSAPDName, SAPMaterialType.Text, SAPUOM.Text, SAPWeight.Text
Close #1
Dim oSAPPNIN As String
'this is where i need to loop inventor until it finds the file
Open "c:\SAP Test Files\in\" & oSAPDataFile &".txt" For Input As #1
'loop again
Line Input #1, oSAPPNIN
SAPPartNumber.Text = oSAPPNIN
Close #1
End Sub
Long story short with 2008 we are no-longer using our in house erp program ans are moving into the "real" world so i have to fix up the code we use to send data to the new erp/mrp system.
Basically i have to send a text file from inventor to a "spooller" location which the erp system monitors if it detects a file in the location it processes the information in it and appends some information to it and saves it back to a folder on the local hard drive where i need Inventror to open it and read the new information back into the part / assembly files iProps. At the moment all the code is working except for the waiting loop where Inventor needs to wait and check if the file has been placed in the local folder. In testing this has taken anywhere betweem 1.9 seconds and almost 1 minute.
I need a way of having Inventor loop around checking for this file and then when it appears triggering the next section of code to strip the text file down etc. I want to do this without setting a wait for 60 seconds for the odd time that it does take this long. so ant help would be appreciated.
Daren
M90 84.26 XPSP2 4 GB
Dim oSAPDataFile As String
oSAPDataFile = Format(Time, "HH-MM-SS")
' Open file for output.
Open "C:\SAP Test Files\out\" & oSAPDataFile & ".txt" For Output As #1
'Set variables to pass to SAP
Dim oSAPDName As String
Dim oSAPDNameLen As String
oSAPDNameLen = Len(FileName.Text)
oSAPDName = Left(FileName.Text, oSAPDNameLen - 4)
' Write comma-delimited data.
Write #1, oSAPDName, SAPMaterialType.Text, SAPUOM.Text, SAPWeight.Text
Close #1
Dim oSAPPNIN As String
'this is where i need to loop inventor until it finds the file
Open "c:\SAP Test Files\in\" & oSAPDataFile &".txt" For Input As #1
'loop again
Line Input #1, oSAPPNIN
SAPPartNumber.Text = oSAPPNIN
Close #1
End Sub