Page 31 of 39

Posted: Mon Mar 09, 2009 10:39 pm
by ts-soft
SFSxOI wrote:Kiffi;

It was a nice example, however, the first 'COMate' one worked fine, the second 'VBS' one doesn't work, at least not here. Just a blank window.
the same here, the second one doesn't work here.

Posted: Mon Mar 09, 2009 10:50 pm
by Kiffi
@SFSxOI & Thomas,

try to insert the following Repeat-Forever-Loop for waiting until the
webgadget is not busy anymore:

Code: Select all

[...]
WebGadget(0, 10, 10, 580, 280, "about:blank")

Repeat
 If GetGadgetAttribute(0, #PB_Web_Busy) = 0
  Break
 EndIf
 While WindowEvent(): Delay(1) : Wend
ForEver

SetGadgetItemText(0, #PB_Web_HtmlCode, ExecuteVbs())
[...]
Greetings ... Kiffi

Posted: Tue Mar 10, 2009 10:25 am
by srod
Or simply add a While WindowEvent() : Wend directly after the WebGadget() command.

Posted: Tue Mar 10, 2009 10:43 am
by Kiffi
srod wrote:Or simply add a While WindowEvent() : Wend directly after the WebGadget() command.
thanks for the hint! I have changed the code.

@SFSxOI & Thomas: Could you test again?

Greetings ... Kiffi

Posted: Tue Mar 10, 2009 11:07 am
by ts-soft
> @SFSxOI & Thomas: Could you test again?
yesterday without problems :wink:

Posted: Tue Mar 10, 2009 11:36 am
by SFSxOI
Yep, works here now :) Thanks


On a sort of related item for something else actually but related for me to this....

how do you set a parameter for a method that includes an 'and' that looks like this:

Code: Select all

updateSearcher.Search("IsInstalled=1 and Type='Software'")
where Search is the method

?

Posted: Tue Mar 10, 2009 11:53 am
by srod
Surely it is just a single string parameter?

Perhaps...

Code: Select all

updateSearche\Invoke("Search('IsInstalled=1 and Type=$0027Software$0027'")

Posted: Tue Mar 10, 2009 12:21 pm
by Kiffi
SFSxOI wrote:where Search is the method
Search is a function, not a method.

Code: Select all

Set SearchResult = UpdateSearcher.Search("...
so you have to use GetObjectProperty()

Greetings ... Kiffi

Posted: Tue Mar 10, 2009 12:59 pm
by SFSxOI
http://msdn.microsoft.com/en-us/library ... S.85).aspx

says its a method. Is it really a function? Would not be the first time the MSDN was misleading in some way or i've misunderstood it.

It says this for the Search ;

"With some restrictions, multiple criteria can be connected with the AND and OR operators. "

and

" A single criterion consists of "Name = Value" or "Name != Value", where "Name" is one of the supported criterion names, and "Value" is a string or an integer. The AND and OR operators can be used to connect multiple criteria. However, OR can be used only at the top level of the search criteria. Therefore, "(x=1 and y=1) or (z=1)" is valid, but "(x=1) and (y=1 or z=1)" is not valid."

and every example i can find for it has it formatted as "updateSearcher.Search("IsInstalled=1 and Type='Software'") " ( or...."updateSearcher.Search("IsInstalled=0 and Type='Software'") " ) with two criterion so I think that it has two criterion.

so, combining srod's example from above and what you presented it looks like this then?

Code: Select all

UpdateSearcher\GetObjectProperty("Search('IsInstalled=1 and Type=$0027Software$0027'")")

or this:

UpdateSearcher\Invoke("Search('IsInstalled=1 and Type=$0027Software$0027'")")

Posted: Tue Mar 10, 2009 1:06 pm
by srod
MSDN would suggest the GetObjectProperty().

Posted: Tue Mar 10, 2009 1:10 pm
by Kiffi
SFSxOI wrote:says its a method. Is it really a function? Would not be the first time the MSDN was incorrect or misleading in some way.
perhaps my english is to bad, but let me explain in this way:

this method has an out-Parameter, so in COMate you have to handle Search() like a function.
MSDN wrote:[out] ISearchResult **retval
the result of Search() must returned somewhere.
SFSxOI wrote:so, combining srod's example from above and what you presented it looks like this then?

Code: Select all

UpdateSearcher\GetObjectProperty("Search('IsInstalled=1 and Type=$0027Software$0027'")")
rather something like this:

Code: Select all

SearchResult.COMateObject = UpdateSearcher\GetObjectProperty("Search('IsInstalled=1 and Type=$0027Software$0027')")
Greetings ... Kiffi

Posted: Tue Mar 10, 2009 1:20 pm
by SFSxOI
ahhh...OK. I see what you guys are saying now. Thank You :)

Posted: Tue Mar 10, 2009 2:07 pm
by srod
When using COMate, any parameters listed as being an 'out' parameter are handled automatically. If you see an 'out' parameter listed in a method's parameter list then you should use one of COMate's Get...Property() calls and it will retrieve the aforementioned value.

You will not ordinarily need to worry about dealing with these 'out' parameters yourself - unless a method lists two or more such parameters! :wink:

Posted: Tue Mar 10, 2009 3:59 pm
by SFSxOI
Thanks srod :)

anyway, what i'm working on is an automated update thing for a project we have comming up this summer. Each summer our company lends its personnel, time, and equipment, to the support of a summer camp for under privilaged children. Part of this camp experience for them includes an introduction to computers and their use. We supply approximately 150 computers each year, all state of the art, for the kids and the staff to use. We get the majority of these from coporation donations and they are brand new except most of them don't come with an operating system installed yet so we have to do that. Last year I used PureBasic to build some automated things that ran during the OS install for setting things up for networking and so on, it worked out great. But this year its a little different. Last year we were able to set up on site and network them all together and do everything at once across the network, this year we will not be able to do that in advanced for most of the machines due to some constraints so when they arrive on site they will have to be ready to plug in and use. One of the things that was missing though was updates to the operating system which meant that we had to visit each machine individually and start the updates. This year we plan to just be able to download and install the updates automatically via a setup in taskmanager to run an update utility which will get, download, and install updates from windows update without any human intervention, and thats what i'm working on now. So far i'm identifying the updates already on the machine (actually some get installed with the automated OS install sequence but the ones from windows update don't), so thats what this code is so far (this is just the windows update portion):

<code removed - it wasn't working - working version posted later in thread two posts from this one>

Still gotta check it out to make sure it works. I haven't started on the download, identifying which ones to install, and install routines yet. yeah, I know there are .vbs scripts to do this but i wanna do it in Purebasic like i did the past stuff.

Posted: Tue Mar 10, 2009 4:01 pm
by srod
Interesting indeed. 8) I hope it all works out.