IvanCodin Posted January 9, 2010 Share Posted January 9, 2010 I am trying to get a progress bar to show while a command is running. I have put the query in multiple places but it doesn't seem to find the right combination. Because I am not do a run command is the a way to show progess until the command completes? Here is the script: #include <AD.au3> _AD_Open() Global $aProperties[1][2] MsgBox(0,"Info", "AD Information for user " & @UserName & " will be found" & @CRLF & "The query may take several minutes to complete",3) ProgressOn("Progress Meter", "Waiting for query to return data", "0 percent") For $i = 10 to 100 step 10 sleep(1000) ProgressSet( $i, $i & " percent") Next MsgBox(0,"TS", "Pre Query",3) $aProperties = _AD_GetObjectProperties(@UserName) MsgBox(0,"TS", "Post Query",3) sleep(500) ProgressOff() MsgBox(0,"TS", "Array is built",3) _ArrayDisplay($aProperties, "AD Functions - Properties for '" & @UserName & "'") MsgBox(0,"TS", "Array is displayed",3) _AD_Close() Link to comment Share on other sites More sharing options...
gte Posted January 9, 2010 Share Posted January 9, 2010 I ran your code sans the _adopen() function and the progress bar launched and worked properly If your progress bar isn't launching with that code snippet, disable the _adopen() and see if it launches, report back. I am trying to get a progress bar to show while a command is running. I have put the query in multiple places but it doesn't seem to find the right combination. Because I am not do a run command is the a way to show progess until the command completes? Here is the script: #include <AD.au3> _AD_Open() Global $aProperties[1][2] MsgBox(0,"Info", "AD Information for user " & @UserName & " will be found" & @CRLF & "The query may take several minutes to complete",3) ProgressOn("Progress Meter", "Waiting for query to return data", "0 percent") For $i = 10 to 100 step 10 sleep(1000) ProgressSet( $i, $i & " percent") Next MsgBox(0,"TS", "Pre Query",3) $aProperties = _AD_GetObjectProperties(@UserName) MsgBox(0,"TS", "Post Query",3) sleep(500) ProgressOff() MsgBox(0,"TS", "Array is built",3) _ArrayDisplay($aProperties, "AD Functions - Properties for '" & @UserName & "'") MsgBox(0,"TS", "Array is displayed",3) _AD_Close() HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
IvanCodin Posted January 9, 2010 Author Share Posted January 9, 2010 (edited) When I comment out the _AD_Open I do not get the result of the query as expected. The query works without any issues. My problem is this: The progress displayed in the current script is really acting as a delay. I am trying to get the progress bar to run while the _AD_getObjectProperties query is competing. I don 't really care about the percentage complete being dispalyed because the script will never compelete within a know timeframe. A scrolling progess bar is actually preferred. The network, size of ad and pc will all effect the time necessary to run the command. runwait looks like it can do this for a dos command but I don't see a way to do this for the query run in this script. Edited January 9, 2010 by IvanCodin Link to comment Share on other sites More sharing options...
gte Posted January 9, 2010 Share Posted January 9, 2010 I'm guessing that your delay (and the reason you need the progress window) is occurring in the _AD_Open() function.The for statement will never be executed until the _AD_Open() function and the lines underneath of it are executed first.You may have to put a do/while or do/until loop in your _AD_Open() function at the point the actual hang occurs atWhen I comment out the _AD_Open I do not get the result of the query as expected. The query works without any issues. My problem is this:The progress displayed in the current script is really acting as a delay. I am trying to get the progress bar to run while the _AD_getObjectProperties query is competing. I don 't really care about the percentage complete being dispalyed because the script will never compelete within a know timeframe. A scrolling progess bar is actually preferred. The network, size of ad and pc will all effect the time necessary to run the command. runwait looks like it can do this for a dos command but I don't see a way to do this for the query run in this script. HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
sheck Posted January 10, 2010 Share Posted January 10, 2010 Maybe something like this, if I understood you correctly: #include <AD.au3> _AD_Open() Global $aProperties[1][2] MsgBox(0,"Info", "AD Information for user " & @UserName & " will be found" & @CRLF & "The query may take several minutes to complete",3) ProgressOn("Progress Meter", "Waiting for query to return data", "0 percent") MsgBox(0,"TS", "Pre Query",3) AdlibRegister("Progress", 1000) $aProperties = _AD_GetObjectProperties(@UserName) MsgBox(0,"TS", "Post Query",3) sleep(500) AdlibUnRegister("Progress") ProgressOff() MsgBox(0,"TS", "Array is built",3) _ArrayDisplay($aProperties, "AD Functions - Properties for '" & @UserName & "'") MsgBox(0,"TS", "Array is displayed",3) _AD_Close() Func Progress() $i += 10 ProgressSet( $i, $i & " percent") EndFunc Live and Learn, 'cause Knowledge is Super Power. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now