krogys Posted March 7, 2018 Posted March 7, 2018 (edited) I want to convert this code to Autoit code. I want to create a program that converts characters in an AutoCAD file. However, I would like to ask all of you who have difficulty in change and who have good ability. Please help me. --------------------------------------------------------------------------------------------------------------------------------------------------------- Private Sub AppActivate Application.Caption On Error Resume Next Dim "find text" As String Dim "change text" As String findtext = InputBox("insert find text : ") changetext = InputBox("insert change text : ") If Err Then Exit Sub 'Filtering Dim Filterset As Object Dim GroupCode As Variant Dim GroupValue As Variant Dim FilterCode(0 To 3) As Integer Dim FilterValue(0 To 3) As Variant FilterCode(0) = -4: FilterValue(0) = "<OR" FilterCode(1) = 0: FilterValue(1) = "TEXT" FilterCode(2) = 0: FilterValue(2) = "MTEXT" FilterCode(3) = -4: FilterValue(3) = "OR>" GroupCode = FilterCode GroupValue = FilterValue On Error Resume Next If ThisDrawing.SelectionSets("TEMP") Then _ ThisDrawing.SelectionSets("TEMP").Delete On Error GoTo 0 Set Filterset = ThisDrawing.SelectionSets.Add("TEMP") Filterset.SelectOnScreen GroupCode, GroupValue If Filterset.Count < 1 Then Exit Sub Dim Change As String Dim i As Integer Dim TextLen As Integer For Each FilterEnt In Filterset FindTextLen = Len(FindText) 변경 = "" For i = 1 To Len(FilterEnt.TextString) If FindText = Mid(FilterEnt.TextString, i, FindTextLen) And _ Len(FilterEnt.TextString) - i + 2 > FindTextLen_ Then Change = ChangeText + FindText i = i + FindTextLen_ - 1 Else: Change = Change + Mid(FilterEnt.TextString, i, 1) End If Next i FilterEnt.TextString = Change FilterEnt.Update Next FilterEnt ThisDrawing.SelectionSets("TEMP").Delete 'delete the selection set AppActivate Application.Caption End Sub --------------------------------------------------------------------------------------------------------------------------- this is my code...TT $oAcad = ObjGet("","AutoCAD.Application") If @error Then Msgbox(0,"ObjGet","Failed ") Exit Endif $ActiveDocument = $oAcad.Activedocument.Name ;~ MsgBox(0,"Name",$ActiveDocument) $iBlocks = $oAcad.Activedocument.Blocks.Count ;~ MsgBox(0,"Count",$iBlocks) $iConp= $oAcad.Activedocument.Blocks.item(0).count ConsoleWrite("="&$iConp & @CRLF) ;~ $oAcad.Activedocument.Blocks.item(0).AddMText( 50, 10, "sdfgsdfsgf") For $a = 0 to $iConp-1 ConsoleWrite($a&"="& $oAcad.Activedocument.Blocks.item(0).Mtext & @CRLF) Next --------------------------- VBA Code NotRun Edited March 7, 2018 by JLogan3o13
DynamicRookie Posted March 8, 2018 Posted March 8, 2018 Hi, Krogys When using COM object manipulation you must have in mind that objects in the environment will vary a lot, and that commands and statements that may exist in VBA may wont in Au3. Test your code before posting it in here, and post the errors returned by your tests.
water Posted March 8, 2018 Posted March 8, 2018 Quote statements that may exist in VBA may wont in Au3 Not true. If you can access an object using COM then this is possible from AutoIt as well. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted March 8, 2018 Posted March 8, 2018 @krogys Can you please give more information about the error you get? "Not working" doesn't help much My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now