I'm attempting to pipe details from the Windows Troubleshooter Dialog, into a file, from calling something such as: MSDT.EXE \ID PowerDiagnostic. My goal is that I would like to capture specifically the Error Code, as I want to run an If = Some Specific Code... Do this... Else... Do that... type of deal.
Hope what I said makes sense. Problem is, how do I capture the info from the blue View Details link which has the goods I want:
Package ID:
Path:
Error Code: (This is what I want)
Source:
User:
Context:
Is it even possible to do this, or at least extract this info? Moreover, It would also be nice to capture the message that states if we have it Disabled By Policy.
I just don't know where to dig for that to extract it. But once I have it, I can certainly run some If/Else/True/False statements against for the next thing I want to do with it.
Related
It's very hard to add this code without revealing sensitive data or even obfuscate it, so I explain problem as best as I can.
There is a user objects, let's call them uo_object and uo_caller.
uo_object has 2 events:
ue_refresh_1 and ue_refresh_2
object uo_caller calls events from uo_object like:
iuo_obj.event ue_refresh1.
PROBLEM:
When i full-build application, and run it, line iuo_obj.event ue_refresh1
calls not event ue_refresh1 but ue_refresh2(?!?!?!?).
But when i open powerbuilder and add a space, new-line any where in this uo_caller,line iuo_obj.event ue_refresh1 calls ue_refresh1.
Of course when i build application after adding space or new-line, this behaviour is repeating.
Does anyone has an idea why?
Consider this a shot in the dark.
Export this object and its ancestors and look for:
Multiple events assigned to the same underlying event id, e.g.
uo_obj
ue_refresh_1 pbm_custom01
uo_ancestor
ue_refresh_2 pbm_custom01
Events assigned to conflicting underlying events, e.g.
uo_obj
ue_refresh_1 pbm_custom01
uo_ancestor
ue_refresh_1 pbm_custom02
Good luck.
I don't really have an idea why but something you could try is to put some additional code around your "iuo_obj.event ue_refresh1" statement. Something like:
IF 1 = 1 THEN
iuo_obj.event ue_refresh1
END IF
Then get latest version on all the objects (you do use source control right?) and then do a full build.
We are using Sys.Desktop.KeyDown and Sys.Desktop.KeyUp VB methods of TestComplete to type into Notepad.
For this we are using a for loop containing KeyDown and KeyUp, however for some reason, even after the for loop ends, the typing is still not complete, its typing slowly, not sure why.
I checked by removing anti-virus software, but still seeing the issue. I have also tried to use the Win32API.GetKeyState(Asc("A")) however sometimes we get 1 and sometimes 0, so really need to debug this issue out. Could anybody suggest a way to debug this issue?
Are you able to use .Keys() on the main text area object?
Something like:
Set textObject = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1).Window("Edit", "", 1)
Call textObject.Keys("Hello")
This is my preferred way of sending text when it is directed toward a particular object. Please refer to this link for more information on the Keys method.
Somebody gave me a testing program to write records into the windows event log (but I don't have the sources). I understand the general way of writing and reviewing event log, but that program behaves very special in a way that I can write records, that have a source which does not exist.
There is not even a registry entry in .../eventlog/application, hence no formatting libs.
If I try that from my own code, I can write such a record but the Windows Event Viewer then always tells me something about "description cannot be found" (which is correct and I understand why that happens).
The question is now: Since that foreign test prog CAN do it, it must be possible somehow - but HOW?
Many thx!! :-)
OK, finally I found it (also, got the sources) - the prog creates the registry entry (probably happens when calling CreateEventSource()), it was just not visible until refreshing regedit :-|
And, it DOES register a formatting lib, only that it is something I cannot rely on: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\EventLogMessages.dll
Or, can I?
Ah, here we go for an explanation:
Difference between EventLog.WriteEntry and EventLog.WriteEvent methods
So, I cannot, as I'm not using .Net ... :-|
Now, if I NOW send another event from MY prog (with the same, newly created source, as the foreign prog), I see it in the event viewer normally.
That means, WriteEntry() actually does not write a different/special type of evt log record containing the text directly (contrary to the standard method of writing just a msg catalog ID + params) but rather there must be some trick in the formatting lib to make the EventViewer apply some kind of "default" formatting.
Any ideas how I could accomplish this? Except just copying the EventLogMessages.dll above? :-)
OK, finally found an answer about this one in http://msdn.microsoft.com/en-us/magazine/cc163446.aspx
"This file is called EventLogMessages.dll, and it contains 65,536 event descriptions, each of which consists of the string "%1", a placeholder for whatever string you want to write"
I was hoping for something like "messageid=*" but that seems to be too simple :-|
But maybe somebody else is interested in whats happening here ...
I know that this is probably a simple question but here is what I'm racking my brain to figure this out:
I know that this:
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index {
return [midiModelContents objectAtIndex:index];
}
will return the item at the index provided. My question is, what code do I need to use to call this routine?
I've tried something like this:
NSString *curData =(comboBox: midiModel objectValueForItemAtIndex:0);
but I get a "error: 'comboBox' undeclared"
Can anyone help me with the concept that I'm messing up?
First, you might want to read the Objective-C Programming Language to learn the correct syntax for sending messages to objects, including yourself.
You get a nonsense error message because you have written (what is in Objective-C) nonsense code. A valid Objective-C message expression would compile and run successfully, but I don't think it would do what you're expecting it to.
You see (and this is the second thing), comboBox:objectValueForItemAtIndex: is not ordinarily a message you send to yourself. The combo box sends that message to you when you are its data source. Data sources are a variation on the delegate pattern that is among the things described in detail in the Cocoa Fundamentals Guide.
(You can send the message to yourself, and it may even make sense to do this if you deliberately want to go through the same object-value-retrieval path the combo box does, but this is not what you need to do to make a combo box work.)
Both the Language document and the Cocoa Fundamentals document are essential reading for every Cocoa programmer, along with the Memory Management Guide for Cocoa. You should read all three documents from start to finish.
The solution to your immediate problem is for the object that responds to comboBox:objectValueForItemAtIndex: to be the data source of the combo box. You will probably hook this up in IB, in the same nib where you created the combo box.
If none of that makes any sense, then all I can suggest to you is, again, to read those documents. They will explain everything.
If you really did simply mean to ask yourself for the object value the same way the combo box does (i.e., you have the combo box working already and intend to get the object value the same way for some other purpose), then you still need to read the Objective-C Programming Language document to learn the correct syntax to send yourself that message.
Background
Lately I've become a fanatic that everything I type while working on a computer should be compatible with "DRY". If there's anything I have to type more than once in any context, I want some kind of user-aware auto-complete option to do some of the work for me -- always -- no exceptions.
Having to work under Windows, I've looked at GUI solutions to make this insane goal a reality.
The (almost) optimal solution
If you have a moment, open up Firefox 3.0 and type a few keystrokes into the address bar. You will notice that it performs a kind of Incremental Autocomplete based on space-separated sub-strings of whatever you type. Another place in Firefox that does something similar is the about:config URL.
This is sub-optimal, because I don't want this in Firefox only. I want to use this everywhere.
The Question
Does anyone out there know of a widget or app that does nothing but insanely good incremental auto-complete that can be used as a general purpose "run everywhere" tool? Something that allows the user to: 1) maintain one or more "completion candidate files"; 2) pick one of those files as the source for Firefox 3.0 style completion; 3) return the result (or blank if the user canceled), and do those three things only?
Details
Here's how it should work:
STEP1: user saves or more csv file(s) (or other easy-edit format) somewhere in his hard-drive
STEP2: user creates a Windows Script Host script or a batch file (or whatever) instantiates the FilterAsYouType GUI
STEP3: user runs the script file, and the script file instantiates the GUI, telling it which CSV file to use as the source of all potential completions
STEP4: the user either chooses one of the completions, supplies his own text that is not in the list, or cancels out without supplying anything
STEP5: when the user is done the script saves the result to a variable and does something with it
Here is some pseudo-code for the script:
include "GenericTypeaheadWidget";
var gengui = new GenericTypaheadWidget('c:\docs\favorite_foods.csv');
var fave_food = gengui.get_user_input();
if(fave_food != ''){
alert('you chose '+fave_food+'!');
}
The rationale
The goal is to just have a way to always be able to do auto-completions from a list of arbitrary items, even if the list is a couple thousand items, and not have to rely on it being built into some IDE or standalone application that only accepts certain kinds of input or has an overly-complicated API relative to the simplicity of this task.
CSV (or text or sqlite database) would provide a way for me to self-generate "candidate lists" or "history logs" and then just use those logs as the source of the possible completions.
The disclaimer
I've tried several GUI "launcher" programs, command-line engines like power-shell and scripting shells, the regular plain old command-line history with varying degrees of satisfaction. The problem with these is they all do extra superfluous stuff like searching directories or built-in commands. I just want nothing but whatever is in the CSV file I happen to be pointing at.
I'm wondering if there is any simple tool that does nothing but what I'm describing above.
UPDATE: It looks like this question is very closely related to Graphical Command Shell, which captures the essential idea presented here.
You should really try Launchy - it's exactly what you're looking for, a "run anything" with intelligent autocompletion. It completely changes the way you interact with a Windows PC.
And it has open source-code, so you can borrow its autocompletion code if you want to roll your own interface.