|
-
Jun 2nd, 2007, 01:33 AM
#1
[RESOLVED] edit RDP file
i want to edit the ip address in a remote desktop connection file, but it is a unicode file, when i read the file using line input then write it back out as a new rdp file it saves as unicode, but the text is ansi so it displays as weird characters
i can convert the file to ansi so it diplays correctly, but i would prefer to keep it in the unicode
Code:
Open "mytest.rdp" For Input As 1
Do While Not EOF(1)
i = i + 1
Line Input #1, strln
If i = 6 Then
lnarr = Split(strln, ":")
lnarr(2) = vastip
strln = Join(lnarr, ":")
End If
rdpstr = rdpstr & strln & vbNewLine
Loop
Close 1
Open "mytest2.rdp" For Output As 1
Print #1, rdpstr ' Mid(rdpstr, 3), will save the file as ANSI
Close 1
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jun 2nd, 2007, 06:26 AM
#2
Re: edit RDP file
i have been able to solve this
vb Code:
Open "mytest2.rdp" For Output As 1
If Not InStr(rdpstr, Chr(&HFF) & Chr(&HFE)) = 0 Then rdpstr = Mid(rdpstr, 3)
ff(0) = &HFF
ff(2) = &HFE
Print #1, ff;
Print #1, StrConv(rdpstr, vbUnicode)
Close 1
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|