Message 1 of 6
iLogic export txt file with ASCII (ANSI) fomatting

Not applicable
10-17-2018
04:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a problem with an iLogic exported txt file.
I need to have it formatted as ASCII (ANSI) and not UTF because charts like Å,Ä,Ö,Ø gets like ööää when import the txt file to ERP system.
iLogic code:
'check that the active document is an drawing file If ThisApplication.ActiveDocument.DocumentType <> kDrawingDocumentObject Then MessageBox.Show("Detta script fungerar endast på ritningsfil" & vbCrLf & "Öppna ritning och kör därifrån", "Varning") Exit Sub End If oFolder = "C:\WF\Pyramid Importfiler\" If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If oWrite = System.IO.File.CreateText(oFolder & ThisDoc.FileName(False) &"-PRODUKT.txt") sweTitle = InputBox("Ange svensk benämning","Ange svensk benämning", iProperties.Value(ThisDoc.FileName(False)+".iam", "Project", "Description")) pyrArtType = InputBox( "Exempel enligt nedan:" & vbCrLf & " " & vbCrLf & "810 Legotillverkad prod mek" & vbCrLf & "820 Egentillverkad prod mek" & vbCrLf & "830 Legomonterad prod mek" & vbCrLf & "840 Egenmonterad prod mek","Ange artikeltyp, OBS! Endast nummer", "840") pyrKalkType = InputBox( "Exempel enligt nedan:" & vbCrLf & " " & vbCrLf & "TB08 - Reservdelar" & vbCrLf & "TB99 - Övrigt" & vbCrLf & "TB02 - Tillbehör lyftare","Ange kalkyltyp, OBS! Endast nummer", "TB08") pyrOpType = InputBox( "Exempel enligt nedan:" & vbCrLf & " " & vbCrLf & "730662 - Svetsning" & vbCrLf & "730663 - Maskinbearbetning" & vbCrLf & "730666 - Montering mekanisk" & vbCrLf & "741766 - Lego PMA","Ange operation i produkt, OBS! Endast nummer", "730666") pyrOpTime = InputBox( "Ange kalkylerade timmar för operation" & vbCrLf,"Ange kalkylerade timmar för operation, OBS! Endast nummer", "1") pyrZink = InputRadioBox("Elförzinkning", "Ja", "Nej", pyrZink, Title := "Ska operation för elförzining läggas till?") oWrite.WriteLine("01" & ThisDoc.FileName(False)) 'Produktbenämning oWrite.WriteLine("#12302;" & sweTitle) 'Artikelbenämning oWrite.WriteLine("#12421;" & sweTitle) 'Artikelbenämning 2 oWrite.WriteLine("#12422;" & iProperties.Value(ThisDoc.FileName(False)+".iam", "Project", "Description")) 'Enhet (styck) oWrite.WriteLine("#12431;S") 'Kategori oWrite.WriteLine("#12415;1") 'Artikeltyp oWrite.WriteLine("#12471;" & pyrArtType) 'Kalkyltyp oWrite.WriteLine("#12475;" & pyrKalkType) 'Operation oWrite.WriteLine("11" & pyrOpType & " " & pyrOpTime) Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oPartList As PartsList oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1) Dim i As Long For i = 1 To oPartList.PartsListRows.Count Dim oRow As PartsListRow oRow = oPartList.PartsListRows.Item(i) Dim oCell As PartsListCell oCell = oRow.Item("Mod no./Dim.") sCell = oCell.Value Dim oCell2 As PartsListCell oCell2 = oRow.Item("Qty") sCell2 = oCell2.Value Dim Result = oWrite.WriteLine("11" & sCell & " " & sCell2) oWrite.WriteLine("#12428;10") Next 'Elförzinkning If pyrZink = True oWrite.WriteLine("11741750" & " " & "1") Else End If oWrite.Close() 'open the file