|
Fine, start by researching the various speech to text libraries that are available.
|
|
|
|
|
That's not a question. That's a statement of what you want to do and the only logical response to it is to say "Permission granted! Please, proceed."
|
|
|
|
|
Hello !
How can I detect if a messagebox is shown ?
I have a situation where I need this.
Thank you !
modified 22-May-14 7:46am.
|
|
|
|
|
Based on the criteria of "message box" really you can't.
A message box window is no different than any other application window, so looking for a "special" window isn't going to work.
You can search for a particular caption message (text in the window title bar) in a window and find out that way, but you have to make sure that the caption you're looking for is unique system-wide.
|
|
|
|
|
The situation is this :
I have a form , where i have implemented IMessageFilter for a panel.
But i want that these filters should not be applied when a child form is opened or a messagebox is displayed. ( because the filter contain rules for mouse events and the forms or messagebox are positioned over this panel )
Now i have resolved the problems with child forms , inserting a condition in filter like this : (Me.OwnedForms.Count = 0) so when a child form is open this condition become false and the filter is not applied. But i want a similar condition for the messagebox.
How can i detect that a message box is shown so i can include a similar condition .
In the form there are over 50 cases when a messagebox can be shown , so i need a way for general detection of MessageBox shown.
|
|
|
|
|
dilkonika wrote: How can i detect that a message box is shown so i can include a similar condition "Detect" is a strange wording; it implies something on the background continually looking for something. You can actively verify if there's an instance of the CheckBox class on the form at that moment.
Imports System.Windows.Forms
Module Module1
Sub Main()
Using f As New Form()
Dim p As New Panel
Dim c1 As New CheckBox With {.Name = "CheckBox1"}
Dim c2 As New CheckBox With {.Name = "CheckBox2"}
f.Controls.Add(p)
f.Controls.Add(c1)
p.Controls.Add(c2)
For Each cb As CheckBox In FindAllCheckBoxes(f)
Console.WriteLine("found {0}", cb.Name)
Next
Console.ReadLine()
End Using
End Sub
Function FindAllCheckBoxes(FromWhere As Control) As IEnumerable(Of CheckBox)
Dim result As New List(Of CheckBox)
For Each c As Control In FromWhere.Controls
If TypeOf c Is CheckBox Then
result.Add(c)
End If
result.AddRange(FindAllCheckBoxes(c))
Next
Return result
End Function
End Module Would also return invisible checkboxes that may be hiding on that form.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I don't understand , why are you talking for "CheckBoxes" ? I want to detect if a MessageBox is shown or not .
|
|
|
|
|
dilkonika wrote: I don't understand , why are you talking for "CheckBoxes" I read checkbox where it says messagebox
And yes, Dave is right, as usual.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Crap, wrong Reply button...
|
|
|
|
|
OK, that doesn't change my answer at all. Again, there is nothing special about a MessageBox window that makes it different from an application window. There's no way to tell the difference.
|
|
|
|
|
Hello !
My messageboxes have all the same Caption : Warning.
I'm using this function :
DllImport("user32.dll", EntryPoint:="FindWindowW")_
Private Function FindWindowW(<marshalas(unmanagedtype.lptstr)> ByVal lpClassName As String, <marshalas(unmanagedtype.lptstr)> ByVal lpWindowName As String) As IntPtr
End Function
Public Function IsMessageBox() As Boolean
Return (FindWindowW("#32770", "Warning !")<> IntPtr.Zero)
End Function
But I don't know but the function IsMessageBox always return "False".
Maybe the class #32770 is not for this kind of window ?
I try SPY++ , but when I select the messagebox window , the class is a very long string ( that exceed the window size). I can read just this : WindowsForms10.Window .8.app.0 (...) can't read the last part.
What is the class ?
Thank you!
|
|
|
|
|
Hello everyone
I have some code that transforms and XML to HTML using a style sheet. The transformation below works fine:
Set oXML = CreateObject("MSXML.DOMDocument")
Set oXSL = CreateObject("MSXML.DOMDocument")
Set fs = CreateObject("Scripting.FileSystemObject")
oXML.Load "D:\some directory\XMLfile.xml"
oXSL.Load "D:\some directory\XSLtheme.xsl"
sHTML = oXML.transformNode(oXSL)
However, the XLS file is usually referenced as a URL rather than a Windows file path (the XLS file is lolcated on a different server). Changing the relevant line to:
oXSL.Load "http://srv001234.internal.com/somedirectory/XSLtheme.xsl"
does not work, presumably since the load method does not work with URL. Do I have to access the file via browser and save locally or is there a quicker method? And if so, what would I have to do to dave the file to the local directory? Many thanks in advance
|
|
|
|
|
Member 10666698 wrote: Do I have to access the file via browser and save locally or is there a quicker method? It has to be downloaded to a local path, and accessed from there.
Member 10666698 wrote: And if so, what would I have to do to dave the file to the local directory? Add a method to download it, and call it. There's an example here[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy
thanks for the reponse, I thought as much. I used the code from your example
Many thanks
|
|
|
|
|
I'm listing the directories using FTPWebRequest and updating the data into a sql table. My code is:
If Con.State = ConnectionState.Closed Then Con.Open()
ObjEventlog.WriteEventLog("TimerListing_Task()", "Connection Is Open Now")
Dim Rs As SqlDataReader = com.ExecuteReader(CommandBehavior.CloseConnection)
While Rs.Read
ListBox1.Items.Add("Listing DeviceID-->" & Rs(0).ToString & " Start...")
ObjEventlog.WriteEventLog("TimerListing_Task()", "Table temp_Listing_result Is Refresh Now For Device ID---> " & Rs(0).ToString)
Dim arr() As String
Dim request As FtpWebRequest = WebRequest.Create("ftp://" & Rs(1) & ":" & Rs(2) & "/" & Rs(3))
request.Credentials = New NetworkCredential(Rs(4).ToString, Rs(5).ToString)
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails
Dim response As FtpWebResponse = request.GetResponse()
Dim responseStream As Stream = response.GetResponseStream()
Dim reader As StreamReader = New StreamReader(responseStream)
ObjEventlog.WriteEventLog("TimerListing_Task()", "WebRequest is Created with ----> " & "ftp://" & Rs(1) & ":" & Rs(2) & "/" & Rs(3))
Dim loadData As String = ""
Dim lineNumber As Integer = 0
While loadData IsNot Nothing
loadData = reader.ReadLine()
arr = Split(loadData, vbNewLine)
For i = 0 To UBound(arr)
If Len(arr(i)) > 0 Then
Dim ss As String = arr(i)
ObjEventlog.WriteEventLog("TimerListing_Task()", "WebRequest Listing Result---> " & ss)
Dim isFolder As String = ss.Substring(0, 4)
If isFolder <> "drwx" Then
ss = Trim(ss.Substring(28))
ObjEventlog.WriteEventLog("TimerListing_Task()", "WebRequest Listing Result After Split---> " & ss)
Dim s() As String = vb.Split(ss, " ")
Dim modifyDate As String = s(1).ToString & " " & s(2).ToString & " " & s(3).ToString
Dim Clip() As String = vb.Split(s(4).ToString, ".")
If Clip.Length = 2 Then
ExecuteQuerys("insert into temp_Listing_result (deviceID, ClipName, ClipSize, ModifyDate, Extn) values(" & Rs(0) & ",'" & Clip(0).ToString & "','" & s(0).ToString & "','" & modifyDate & "','" & Clip(1).ToString & "')")
SqlQry = "update temp_Listing_result_process deviceID=" & Rs(0) & ", ClipName='" & Clip(0).ToString & "', ClipSize='" & s(0).ToString & "', ModifyDate='" & modifyDate & "', Extn='" & Clip(1).ToString & "' where deviceID=" & Rs(0) & ""
ExecuteQuerys(SqlQry)
Else
ExecuteQuerys("insert into temp_Listing_result (deviceID, ClipName, ClipSize, ModifyDate, Extn) values(" & Rs(0) & ",'" & Clip(0).ToString & "','" & s(0).ToString & "','" & modifyDate & "','')")
SqlQry = "update temp_Listing_result_process deviceID=" & Rs(0) & ", ClipName='" & Clip(0).ToString & "', ClipSize='" & s(0).ToString & "', ModifyDate='" & modifyDate & "' where deviceID=" & Rs(0) & ""
ExecuteQuerys(SqlQry)
End If
ListBox1.Items.Add(arr(i))
Else
ObjEventlog.WriteEventLog("TimerListing_Task()", "Folder Found ,Listing Not Done For Folder")
End If
End If
Quote: Here I've done Listing and throwing the data in the table temp_Listing_result.
If I'm inserting data only in single table then It's working fine but I want to update another temp_Listing_result_process table with previous table.
I'm getting wrong data: The data is only of one device and table is consisting only one directory data repetitively.
I'm having 4 directories, But when I listing it's listing only one device and inserting the same data again and again.
Please share your experiences.
Thanks!
|
|
|
|
|
Hello everyone
I would like to convert an XML file to Excel (xls, xlsx) using the stylesheet referenced (XSL). This is done easily opening the XML file in Excel and confirming the XSL reference. I need this to be executed from a VBScript however:
1. Open XML in Excel with style applies
2. Save to a central directory as workbook (e.g. xls)
I have only a basic understanding of VBScript. Any help is greatly appreciated
p.s. VBA apparently know a method called workbook.openXML with XSL as a parameter. I assume there is no equivalency in VBScript?
|
|
|
|
|
If you know how to do it manually in Excel, use the developer functions to record a macro - this will show the code needed to do it programatically
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Hello Chris
thanks for the quick reply. Here is what I have following your suggestion:
Sub Macro1()
ChDir "D:\some directory..."
Workbooks.OpenXML Filename:= _
"D:\some directory/somefile.xml", _
Stylesheets:=Array(1)
End Sub
This works fine in VBA (i.e. running the macro from Excel). Unfortunately, I have to execute the code from within a VBScript and the language does not seem to acknowledge the Workbooks.OpenXML reference. Any ideas?
|
|
|
|
|
You will nead to create an Excel application - Look here for some examples[^]
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Okay, slowly getting there. This is what I have:
Dim xlApp, xlWkb, SourceFolder,TargetFolder,file
Set xlApp = CreateObject("excel.application")
Set fs = CreateObject("Scripting.FileSystemObject")
Const xlNormal=1
filestr="D:\some directory\some file.xml"
TargetFolder="D:\some directory\xls"
xlApp.Visible = False
Set xlApp = CreateObject("Excel.Application")
Set xlWkb = xlApp.Workbooks.OpenXML(filestr, Array(1), 2)
BaseName= fs.getbasename(filestr)
FullTargetPath=TargetFolder & "\" & BaseName & ".xls"
xlWkb.SaveAs FullTargetPath, xlNormal
xlWkb.close
Set xlWkb = Nothing
Set xlApp = Nothing
Set fs = Nothing
End Sub
This will open the XML fiel, apply the style sheet and save it as a workbook. However, the code is interrupted by the opo-up window in Ezxcel prompting the user to apply the XSL fiel or not. The code continues only after clicking 'OK'. The code needs to run uninterrupted. Parameter 3 of OpenXML should be the load method: 2 = xlXmlLoadImportToList. Not sure I am using the correct parameter?
|
|
|
|
|
Okay, this seems like a confirmed bug:
http://support.microsoft.com/kb/307230/en-US
The solution is to convert to HTML first, then to xls. The workaround code in VBA:
Sub Macro3()
Dim oXML As Object, oXSL As Object
Set oXML = CreateObject("MSXML.DOMDocument")
Set oXSL = CreateObject("MSXML.DOMDocument")
oXML.Load "c:\customers.xml"
oXSL.Load "c:\customers.xsl"
Dim sHTML As String
sHTML = oXML.transformNode(oXSL)
Open "c:\customers.htm" For Output As #1
Print #1, sHTML
Close #1
Dim oApp As Excel.Application
Set oApp = CreateObject("excel.application")
oApp.Visible = True
oApp.Workbooks.Open "c:\customers.htm"
End Sub
This fails when trying to save the HTML file, presumably because the file cannot be referenced that way in VBScript:
Open "c:\customers.htm" For Output As #1
What do I need to change to save this as HTML?
p.s. I realise this forum is VB but I could not find a disgnated VBScript section
|
|
|
|
|
It fails because you shouldn't write in the root. The PC will explode if you do that.
Member 10666698 wrote: p.s. I realise this forum is VB but I could not find a disgnated VBScript section No surprise there, VBA has been abandoned with VB6.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
While that is good to know I still have no idea how to do this in VBScript. Assume I know nothing about VBScript
|
|
|
|
|
|
Second sentence in that link: Despite Microsoft's best efforts to kill VBA off
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|