Sub Button1_Click
OpenSearch("D:\Documents\AnywhereSoftware\AdditionalLibs\B4X","sl")
End Sub
Private Sub OpenSearch(Path As String,SearchTerm As String)
Dim FileExtns As String
FileExtns = "&crumb="
FileExtns = FileExtns & "fileextension%3A.b4xlib?"
Dim DisplayName As String = $"&displayname=b4xlib"$
Dim SU As StringUtils
Path = SU.EncodeUrl(Path,"UTF8")
Dim SearchTerm As String = $"&crumb=System.Generic.String%3A${SU.EncodeUrl(SearchTerm,"UTF8")}"$
fx.ShowExternalDocument($"search-ms:${DisplayName}${SearchTerm}${FileExtns}&crumb=location:${Path}"$)
End Sub
You need to search for "search-ms" and "crumb" in relation to the Windows File explorer.
Here is some code that I ripped out of an app and got working stand alone. I can't really remember exactly how it all fit's together (I wrote it a good few years ago) but I know it works. It may point you in the right direction.
B4X:
Sub Button1_Click
OpenSearch("D:\","test")
End Sub
Private Sub OpenSearch(Path As String,SearchTerm As String)
Dim FileExtns As String
FileExtns = "&crumb="
FileExtns = FileExtns & "fileextension%3A.b4?"
FileExtns = FileExtns & "%20OR%20"
FileExtns = FileExtns & "fileextension%3A.bas"
FileExtns = FileExtns & "%20OR%20"
FileExtns = FileExtns & "fileextension%3A.css"
FileExtns = FileExtns & "%20OR%20"
FileExtns = FileExtns & "fileextension%3A.txt"
Dim DisplayName As String = $"&displayname=Search%20Results%20in%20Search"$
Dim SU As StringUtils
Path = SU.EncodeUrl(Path,"UTF8")
Dim SearchTerm As String = $"&crumb=System.Generic.String%3A${SU.EncodeUrl(SearchTerm,"UTF8")}"$
fx.ShowExternalDocument($"search-ms:${DisplayName}${SearchTerm}${FileExtns}&crumb=location:${Path}"$)
End Sub
Hi everyone,
I have included a test project, but under no circumstances can I open a Windows window with File Explorer along with the B4X Library (.b4xlib) files ("SEARCH" as a result).
Rather, an attempt is made to open the searched file for editing, and all I expect is to open a view window with the searched files (.b4xlib) that are not associated with any program on the system. Hence the problem.
You need to search for "search-ms" and "crumb" in relation to the Windows File explorer.
Here is some code that I ripped out of an app and got working stand alone. I can't really remember exactly how it all fit's together (I wrote it a good few years ago) but I know it works. It may point you in the right direction.
B4X:
Sub Button1_Click
OpenSearch("D:\","test")
End Sub
Private Sub OpenSearch(Path As String,SearchTerm As String)
Dim FileExtns As String
FileExtns = "&crumb="
FileExtns = FileExtns & "fileextension%3A.b4?"
FileExtns = FileExtns & "%20OR%20"
FileExtns = FileExtns & "fileextension%3A.bas"
FileExtns = FileExtns & "%20OR%20"
FileExtns = FileExtns & "fileextension%3A.css"
FileExtns = FileExtns & "%20OR%20"
FileExtns = FileExtns & "fileextension%3A.txt"
Dim DisplayName As String = $"&displayname=Search%20Results%20in%20Search"$
Dim SU As StringUtils
Path = SU.EncodeUrl(Path,"UTF8")
Dim SearchTerm As String = $"&crumb=System.Generic.String%3A${SU.EncodeUrl(SearchTerm,"UTF8")}"$
fx.ShowExternalDocument($"search-ms:${DisplayName}${SearchTerm}${FileExtns}&crumb=location:${Path}"$)
End Sub
Interesting direction, but I will check if an example will work for me - when handling files like .b4xlib?
Because these are the types of files that I care about.
Thanks to everyone for the attention and help for a moment.
Sub Button1_Click
OpenSearch("D:\Documents\AnywhereSoftware\AdditionalLibs\B4X","sl")
End Sub
Private Sub OpenSearch(Path As String,SearchTerm As String)
Dim FileExtns As String
FileExtns = "&crumb="
FileExtns = FileExtns & "fileextension%3A.b4xlib?"
Dim DisplayName As String = $"&displayname=b4xlib"$
Dim SU As StringUtils
Path = SU.EncodeUrl(Path,"UTF8")
Dim SearchTerm As String = $"&crumb=System.Generic.String%3A${SU.EncodeUrl(SearchTerm,"UTF8")}"$
fx.ShowExternalDocument($"search-ms:${DisplayName}${SearchTerm}${FileExtns}&crumb=location:${Path}"$)
End Sub
YES. From this list, I only want to have a few selected files, if they exist of course. So the search result in the Windows window, i.e. in the File Explorer
Sub Button1_Click
OpenSearch("D:\Documents\AnywhereSoftware\AdditionalLibs\B4X","sl")
End Sub
Private Sub OpenSearch(Path As String,SearchTerm As String)
Dim FileExtns As String
FileExtns = "&crumb="
FileExtns = FileExtns & "fileextension%3A.b4xlib?"
Dim DisplayName As String = $"&displayname=Search%20Results%20in%20Search"$
Dim SU As StringUtils
Path = SU.EncodeUrl(Path,"UTF8")
Dim SearchTerm As String = $"&crumb=System.Generic.String%3A${SU.EncodeUrl(SearchTerm,"UTF8")}"$
fx.ShowExternalDocument($"search-ms:${DisplayName}${SearchTerm}${FileExtns}&crumb=location:${Path}"$)
End Sub
... a small fix to thread#17 this change improves the "+" sign in the folder path.
Correction: fix from SU.EncodeUrl to SU.DecodeUrl:
'Show the b4xlib archive file
Private Sub btnShowLib_Click
Dim FileName As String = tflibTarget.Text
OpenSearch(lblB4xLibDeploy.Text,FileName)
End Sub
'Open search results in the Libs folder
Private Sub OpenSearch(Path As String, SearchTerm As String)
Dim FileExtns As String
FileExtns = "&crumb="
FileExtns = FileExtns & "fileextension%3A.b4xlib?"
Dim DisplayName As String = $"DisplayName=Wyniki%20wyszukiwania%20w%20folderze%20Libraries"$
Dim SU As StringUtils
Path = SU.DecodeUrl(Path,"UTF8")
Dim SearchTerm As String = $"&crumb=System.Generic.String%3A${SU.DecodeUrl(SearchTerm,"UTF8")}"$
fx.ShowExternalDocument($"search-ms:${DisplayName}${SearchTerm}&crumb=location:${Path}"$)
End Sub