Rakshith004 Posted March 30 Share Posted March 30 (edited) Hello Everybody, Hope everyone is doing good. I need help in modifying the GUI and it's height and width, Can somebody help me please? Below script works fine but it's small. My goal is to apply wim file to C drive using dism command which acts as a factory reset. $wimfile = "C:\wim\Factory-Reset.wim" $targetpath = "D:\" $percent = 0 $value = 0 $Title = "Recovery Tools" $DISMp = Run(@ComSpec & " /c title " & $Title & "|" & 'Dism.exe /mount-wim /wimfile:"' & $wimfile & '" /index:1 /mountdir:"' & $targetpath, "", "", 2 + 4) $iMsgBoxAnswer = MsgBox(68, "Please confirm", "Are you sure you want to restore????") Select Case $iMsgBoxAnswer = 6 ;Yes Run ("$DISMp") Case $iMsgBoxAnswer = 7 ;No Exit EndSelect ProgressOn("Recovery Tools", "Restoring Factory Image", "0 percent") While ProcessExists($DISMp) $line = StdoutRead($DISMp, 5) If StringInStr($line, ".0%") Then $line1 = StringSplit($line, ".") $value = StringRight($line1[$line1[0] - 1], 2) $value = StringStripWS($value, 7) EndIf If $value == "00" Then $value = 100 If @error Then ExitLoop Sleep(50) If $percent <> $value Then ProgressSet($value, "Restoring Factory Image", "Completed..." & $value & "%") $percent = $value EndIf If $value = 100 Then Shutdown (2) WEnd ProgressOff() Edited March 30 by Jos added codebox Link to comment Share on other sites More sharing options...
Developers Jos Posted March 30 Developers Share Posted March 30 There is no GUI in that script, just a standard windows MSGBOX(), so what exactly is your goal? Increasing the size of the standard MSGBOX? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Nine Posted March 30 Share Posted March 30 I suppose it is the progress bar that he finds too small. One solution is to create a custom GUI progress bar with the desired size, but why reinvent the wheel. Just adjust the size of each component : expandcollapse popup#include <WinAPISysWin.au3> #include <String.au3> #include <WinAPIGdi.au3> #include <FontConstants.au3> ProgressOn("Test", "Main text", "Sub Text") Local $hWnd = WinGetHandle("Test") WinMove($hWnd, "", 200, 200, 600, 250) Local $hText1 = ControlGetHandle($hWnd, "", "Static1") Local $hProgress = ControlGetHandle($hWnd, "", "msctls_progress321") Local $hText2 = ControlGetHandle($hWnd, "", "Static2") Local $aPos = ControlGetPos($hWnd, "", $hText1) _WinAPI_MoveWindow($hText1, $aPos[0], $aPos[1], $aPos[2] * 2, $aPos[3] * 2) Local $hFont1 = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') _WinAPI_SetFont($hText1, $hFont1) $aPos = ControlGetPos($hWnd, "", $hProgress) _WinAPI_MoveWindow($hProgress, $aPos[0], $aPos[1] + 50, $aPos[2] * 2, $aPos[3] * 2) $aPos = ControlGetPos($hWnd, "", $hText2) _WinAPI_MoveWindow($hText2, $aPos[0], $aPos[1] + 85, $aPos[2] * 2, $aPos[3] * 2) Local $hFont2 = _WinAPI_CreateFont(40, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') _WinAPI_SetFont($hText2, $hFont2) For $i = 10 To 100 Step 10 Sleep(500) ProgressSet($i, $i & "%") Next ProgressSet(100, "Done", "Complete") Sleep(2000) _WinAPI_DeleteObject($hFont1) _WinAPI_DeleteObject($hFont2) ProgressOff() If it is the MsgBox that is too small, you can pretty much do the same, but you will need to hook the MsgBox to a CBT proc. In any case, I felt it is a good example of how to reuse an existing function without creating it from scratch... ioa747 and Zedna 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Rakshith004 Posted March 30 Author Share Posted March 30 6 hours ago, Jos said: There is no GUI in that script, just a standard windows MSGBOX(), so what exactly is your goal? Increasing the size of the standard MSGBOX? Yes please. Link to comment Share on other sites More sharing options...
Rakshith004 Posted March 30 Author Share Posted March 30 5 hours ago, Nine said: I suppose it is the progress bar that he finds too small. One solution is to create a custom GUI progress bar with the desired size, but why reinvent the wheel. Just adjust the size of each component : expandcollapse popup#include <WinAPISysWin.au3> #include <String.au3> #include <WinAPIGdi.au3> #include <FontConstants.au3> ProgressOn("Test", "Main text", "Sub Text") Local $hWnd = WinGetHandle("Test") WinMove($hWnd, "", 200, 200, 600, 250) Local $hText1 = ControlGetHandle($hWnd, "", "Static1") Local $hProgress = ControlGetHandle($hWnd, "", "msctls_progress321") Local $hText2 = ControlGetHandle($hWnd, "", "Static2") Local $aPos = ControlGetPos($hWnd, "", $hText1) _WinAPI_MoveWindow($hText1, $aPos[0], $aPos[1], $aPos[2] * 2, $aPos[3] * 2) Local $hFont1 = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') _WinAPI_SetFont($hText1, $hFont1) $aPos = ControlGetPos($hWnd, "", $hProgress) _WinAPI_MoveWindow($hProgress, $aPos[0], $aPos[1] + 50, $aPos[2] * 2, $aPos[3] * 2) $aPos = ControlGetPos($hWnd, "", $hText2) _WinAPI_MoveWindow($hText2, $aPos[0], $aPos[1] + 85, $aPos[2] * 2, $aPos[3] * 2) Local $hFont2 = _WinAPI_CreateFont(40, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') _WinAPI_SetFont($hText2, $hFont2) For $i = 10 To 100 Step 10 Sleep(500) ProgressSet($i, $i & "%") Next ProgressSet(100, "Done", "Complete") Sleep(2000) _WinAPI_DeleteObject($hFont1) _WinAPI_DeleteObject($hFont2) ProgressOff() If it is the MsgBox that is too small, you can pretty much do the same, but you will need to hook the MsgBox to a CBT proc. In any case, I felt it is a good example of how to reuse an existing function without creating it from scratch... Sure i'm gonna try this and post the results Link to comment Share on other sites More sharing options...
Nine Posted March 30 Share Posted March 30 So you want to increase size of the MsgBox. It will be easier to use this UDF, instead of trying to manipulate the standard MsgBox components. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Rakshith004 Posted April 1 Author Share Posted April 1 (edited) Well i tried to merge the code with your code but it's not working and showing boxes but no progress in backend, Sorry i am a beginner please help me in fixing the code. expandcollapse popup#include <WinAPISysWin.au3> #include <String.au3> #include <WinAPIGdi.au3> #include <FontConstants.au3> $wimfile = "C:\wim\Winre.wim" $targetpath = "C:\mount" $percent = 0 $value = 0 $Title = "Recovery Tools" $DISMp = Run(@ComSpec & " /c title " & $Title & "|" & 'Dism.exe /mount-wim /wimfile:"' & $wimfile & '" /index:1 /mountdir:"' & $targetpath, "", "", 2 + 4) $iMsgBoxAnswer = MsgBox(68, "Please confirm", "Are you sure you want to restore????") Select Case $iMsgBoxAnswer = 6 ;Yes Run ("$DISMp") Case $iMsgBoxAnswer = 7 ;No Exit EndSelect ProgressOn("Recovery Tools", "Restoring Factory Image", "0 percent") ProgressOn("Test", "Restoring Factory OS", "Sub Text") Local $hWnd = WinGetHandle("Recovery Tools") WinMove($hWnd, "", 200, 200, 600, 250) Local $hText1 = ControlGetHandle($hWnd, "", "Static1") Local $hProgress = ControlGetHandle($hWnd, "", "msctls_progress321") Local $hText2 = ControlGetHandle($hWnd, "", "Static2") Local $aPos = ControlGetPos($hWnd, "", $hText1) _WinAPI_MoveWindow($hText1, $aPos[0], $aPos[1], $aPos[2] * 2, $aPos[3] * 2) Local $hFont1 = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') _WinAPI_SetFont($hText1, $hFont1) $aPos = ControlGetPos($hWnd, "", $hProgress) _WinAPI_MoveWindow($hProgress, $aPos[0], $aPos[1] + 50, $aPos[2] * 2, $aPos[3] * 2) $aPos = ControlGetPos($hWnd, "", $hText2) _WinAPI_MoveWindow($hText2, $aPos[0], $aPos[1] + 85, $aPos[2] * 2, $aPos[3] * 2) Local $hFont2 = _WinAPI_CreateFont(40, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') _WinAPI_SetFont($hText2, $hFont2) For $i = 10 To 100 Step 5 Sleep(500) ProgressSet($i, $i & "%") Next ProgressSet(100, "Done", "Complete") Sleep(2000) _WinAPI_DeleteObject($hFont1) _WinAPI_DeleteObject($hFont2) ProgressOff() On 3/30/2024 at 5:55 PM, Rakshith004 said: Sure i'm gonna try this and post the results Edited April 1 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Rakshith004 Posted April 1 Author Share Posted April 1 On 3/31/2024 at 12:26 AM, Nine said: So you want to increase size of the MsgBox. It will be easier to use this UDF, instead of trying to manipulate the standard MsgBox components. Let me try to modify. Link to comment Share on other sites More sharing options...
Solution Nine Posted April 1 Solution Share Posted April 1 (edited) When you post code, please use the method described in the link. You can edit your post with the ... in the upper right corner of your post. The problem is that you have 2 ProgressOn statements. Remove the second, should work. Edited April 1 by Nine Rakshith004 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Rakshith004 Posted April 1 Author Share Posted April 1 1 hour ago, Nine said: When you post code, please use the method described in the link. You can edit your post with the ... in the upper right corner of your post. The problem is that you have 2 ProgressOn statements. Remove the second, should work. Thank you everything is working fine... Marked as solution. This forum is best and pretty fast. 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