combine this soft with Autocad

Have a suggestion for "Everything"? Please post it here.
Post Reply
panliang9
Posts: 5
Joined: Mon Sep 19, 2016 5:33 am

combine this soft with Autocad

Post by panliang9 »

this soft is amazing! thank author!

could this soft combine with AutoCAD , when the user of AutoCAD touch some txt in AutoCAD drawings , then this soft quickly open a dialogue box ,this dialogue box show all drawing which name contain the txt 。

it will be very good !

thanks
therube
Posts: 4979
Joined: Thu Sep 03, 2009 6:48 pm

Re: combine this soft with Autocad

Post by therube »

I know nothing of Audocad, but if it can do "macros", I'd think you could do it?

Similar in concept to, how to add everything as a search engine in firefox?, which uses a bookmarklet, a little bit of JavaScript, attached to a "button" (bookmark), if you will, that when you click the button (bookmark), searches for the text highlighted in your browser web page.
klarah
Posts: 8
Joined: Mon Aug 18, 2014 12:33 pm

Re: combine this soft with Autocad

Post by klarah »

panliang9
Posts: 5
Joined: Mon Sep 19, 2016 5:33 am

Re: combine this soft with Autocad

Post by panliang9 »

thank you, you guy are very kind!

I will try the idea of "macro", if it works I will report to you !
panliang9
Posts: 5
Joined: Mon Sep 19, 2016 5:33 am

Re: combine this soft with Autocad

Post by panliang9 »

after discussing this project with some friend in china BBS , friends here help me make this idea come to true . who use this macro must change the everything.exe folder location in the code.
bellow is the code of marco, the credit is zzyong00, I supply the idea
________________________________________________________________________________________________
Option Explicit

Public Sub SearchWithEverything()
'EveryThing searchtext
'By zzyong00 2016.10.23\
'Idea By panliang9
Dim objEnt As AcadEntity, pt1 As Variant
Dim objT As AcadText, objMT As AcadMText
Dim strCon As String
On Error GoTo err1
AppActivate ThisDrawing.Application.Caption
ThisDrawing.Utility.GetEntity objEnt, pt1, "please select the text"
'Debug.Print objEnt.ObjectName
If objEnt.ObjectName = "AcDbText" Then
Set objT = objEnt
strCon = objT.TextString
ElseIf objEnt.ObjectName = "AcDbMText" Then
Set objMT = objEnt
strCon = MtextStringClearFormat(objMT.TextString)
Else

End If

'attention here you must change everything.exe file folder like bellow
Shell "D:\Program Files\Everything\Everything.exe -s " & Chr(34) & strCon & "*" & Chr(34)
'AppActivate strCon & " - Everything"
Exit Sub
err1:
If Err.Number = -2147352567 Then
Err.Clear
Else
MsgBox Err.Description, vbOKOnly + vbCritical
End If
End Sub
Private Function MtextStringClearFormat(MTextString As String) As String
Dim MyString As String
MyString = MTextString
MyString = ReplaceByRegExp(MyString, "\\{", Chr(1))
MyString = ReplaceByRegExp(MyString, "\\}", Chr(2))
MyString = ReplaceByRegExp(MyString, "\\\\", Chr(3))
MyString = ReplaceByRegExp(MyString, "\\S([^;]*?)(\^|#)([^;]*?);", "$1$3")
MyString = ReplaceByRegExp(MyString, "\\S([^;]*?);", "$1")
MyString = ReplaceByRegExp(MyString, "(\\P|\\O|\\o|\\L|\\l|\{|\})", "")
MyString = ReplaceByRegExp(MyString, "\\[^;]*?;", "")
MyString = ReplaceByRegExp(MyString, "\x01", "{")
MyString = ReplaceByRegExp(MyString, "\x02", "}")
MyString = ReplaceByRegExp(MyString, "\x03", "\")
MtextStringClearFormat = Trim(MyString)
End Function
Private Function ReplaceByRegExp(ByVal Mystrig As String, ByVal TxtFind As String, ByVal TxtReplace As String)
Dim RE As Object
Set RE = ThisDrawing.Application.GetInterfaceObject("Vbscript.RegExp")

RE.IgnoreCase = False
RE.Global = True

RE.Pattern = TxtFind
ReplaceByRegExp = RE.Replace(Mystrig, TxtReplace)
Set RE = Nothing

End Function
Post Reply