Jump to content

Comment MsgBox doesn't get any information


i2i8
 Share

Go to solution Solved by Andreik,

Recommended Posts

I have a script  like this:

Local $GUID, $BootEntryName = "Test"

Local $sPid = Run('bcdedit /create /d ' & '"' & $BootEntryName & '"' & ' /application OSLOADER','','', $STDOUT_CHILD + $STDERR_CHILD)

If StringRegExp(StdoutRead($sPid), '(?i){',3) Then
    MsgBox(0,0,'Yes')
    $GUID = _StringBetween(StdoutRead($sPid), "{", "}")
    ConsoleWrite($GUID[0])
EndIf

In the code above, if I comment out the MsgBox , ConsoleWrite does not output any information. Why?

Edited by i2i8
Link to comment
Share on other sites

  • i2i8 changed the title to Comment MsgBox doesn't get any information
11 minutes ago, Andreik said:

Maybe using ProcessWaitClose() before reading stdout will fix it.

Thank you so much, you are right, the final code is as follows:

Local $sPid = Run('bcdedit /create /d ' & '"' & $BootEntryName & '"' & ' /application OSLOADER','','', $STDOUT_CHILD + $STDERR_CHILD)

If StringRegExp(StdoutRead($sPid), '(?i){',3) Then
  ProcessWaitClose($sPid)
  $GUID = _StringBetween(StdoutRead($sPid), "{", "}")
EndIf

MsgBox(0,0,$GUID[0])

 

Edited by i2i8
Link to comment
Share on other sites

11 minutes ago, i2i8 said:

Thank you so much, you are right, the final code is as follows:

Local $sPid = Run('bcdedit /create /d ' & '"' & $BootEntryName & '"' & ' /application OSLOADER','','', $STDOUT_CHILD + $STDERR_CHILD)

If StringRegExp(StdoutRead($sPid), '(?i){',3) Then
  ProcessWaitClose($sPid)
  $GUID = _StringBetween(StdoutRead($sPid), "{", "}")
EndIf

MsgBox(0,0,$GUID[0])

 

Probably it would be even better if you place the line after Run() and before StringRegExp().

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...