Die Sidebar und CreateObject(„WScript.Shell“)
It is to excite :motzen:
For a long time it annoys me that I cannot work from the Vista Sidebar by VBScript with CreateObject(„WScript.Shell“). Seems as if Microsoft would have prevented that, thus for harming software it is more difficulty to do bad things.
There are a few cheats to go around this, but if I want to get the output of a command prompt by using VBScript, then only the detour helps to temporarly write the result into a file.
However, such a thing I do not want!
Fortunately ’s there still Javascript and the new ActiveXObject(„WScript.Shell“) with which I always marvelously could help me so far.
Well, so far in Vista. Now I have this function in my beta of margu-NotebookInfo2 2.1.0 for the moment to work over with the powerplans. I make that – because I still didn’t found no better way on script basis – to query and also change hose available powerplans by the command line.
There I was surprised why this module of my Gadget won’t function under Windows7 RC and had to state that not only the VBScript function of the CreateObject, but now also the counterpart in Javascript, which works at least in Vista, is deactivated.
And now I stand there and seek desperately in the net already for a solution with which I can live.
Thus it dows not surprise that I still stand on beta4 of my gadget, because finally my gadget shall work with Windows7 too.
Es ist zum Aus-der-Haut-fahren :motzen:
Schon lange wurmt mich, daß man aus der Vista Sidebar heraus nicht per VBScript mit CreateObject(„WScript.Shell“) arbeiten kann. Scheint als hätte Microsoft das unterbunden, damit es für Schadsoftware schwieriger ist böse Dinge anzustellen.
Es gibt zwar ein paar Tricks um das zu umgehen, aber wenn ich möchte, daß das VBScript mir z.B. die Ausgabe von einer Kommandozeile zurückgibt, dann hilft nur der Umweg über eine Datei in die man das Ergebnis temporär schreibt.
Sowas will ich aber nicht!
Zum Glück gibts ja da noch JavaScript und das new ActiveXObject(„WScript.Shell“) womit ich mir bisher immer wunderbar helfen konnte.
Tja, soweit in Vista. Nun habe ich diese Funktion im Moment in meiner Beta von margu-NotebookInfo2 2.1.0 um mit den Energiesparplänen zu arbeiten. Das mache ich – weil ich noch keinen besseren Weg auf Scriptbasis gefunden habe – um über die Kommandozeile die vorhanden Energiesparpläne abzufragen und auch zu wechseln.
Da wunderte ich mich, warum dieses Modul meines Gadgets nicht unter Windows7 RC funktioniert und mußte feststellen, daß dort nicht nur die VBScript Funktion des CreateObject deaktiviert ist, sondern jetzt auch das JavaScript Pendant, welches zumindest in Vista funktioniert.
Und nun stehe ich da und suche schon verzweifelt im Netz nach einer Lösung mit der ich leben kann.
Also nicht wundern, warum ich vorerst auf der Beta4 stehen bleibe, denn schließlich soll mein Gadget auch unter Windows7 funktionieren.
Ok, habe nun festgestellt, daß ich meine Aussage zum Teil zurückziehen muß.
Die Funktionen CreateObject(”WScript.Shell”) (in vbscript) bzw. new ActiveXObject(”WScript.Shell”) (in javascript) kann man doch benutzen. :red: Ich selbst habe einen Fehler in meinem Script gehabt, wodurch unter Windows7 nicht alles rund lief. :wall: Trotzdem scheint es so als wenn in Windows7 ein bisschen was anders funktioniert.
Um alle Eventualitäten auszuschließen, nutze ich nun doch die Funktion ExecHidden von dieseyer um im Temp-Ordner eine Datei zu erstellen, die ich dann vom Script aufrufen lasse. Ist zwar nicht ganz das was ich wollte, funktioniert aber bisher zuverlässig. Hat auch den netten Nebeneffekt, daß nun keine Kommandozeile mehr aufpoppt. :ok:
In diesem Sinne …