Jump to content
Sign in to follow this  
satanttin

Convert to ntfs exe problem

Recommended Posts

satanttin

Hello folks,

Little question i searched  for a code to convert fat32 drives to ntfs and i found a decent one just one problem. When i make it an .exe the script  freaks out and open a few times and can't exit the program else it runs a second time O.o which is weird since it works perfectly in scite itself.

the url i found it is '?do=embed' frameborder='0' data-embedContent>>

the code i have sofar is:

#include <GuiConstants.au3>

Global $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $WS_OVERLAPPEDWINDOW, $WS_VISIBLE, $WS_CLIPSIBLINGS

GuiCreate("Auto Convert", 425, 322,(@DesktopWidth-425)/2, (@DesktopHeight-362)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$eOutput = GuiCtrlCreateEdit("", 0, 10, 423, 260, BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY))
$bExit = GuiCtrlCreateButton("Exit", 340, 273, 60, 20)

GuiSetState()
; Run child process and provide console i/o for it.
; Parameter of 2 = provide standard output

$Drive = InputBox ("Enter drive...", "test")

If DriveGetFileSystem($Drive& ":\") <> "NTFS" Then
$ourProcess = Run("convert " &$Drive&": /fs:ntfs", @SystemDir, @SW_HIDE, 3)
While 1
   If $ourProcess Then
  ; Calling StdoutRead like this returns the characters waiting to be read
      $charsWaiting = StdoutRead($ourProcess, 0 , 1)
      If @error = -1 Then
         $ourProcess = 0
            MsgBox(0, "App Exited", "Process has exited...")
         ContinueLoop
      EndIf
      If $charsWaiting Then
         $currentRead = StdoutRead($ourProcess)
         GUICtrlSetData($eOutput, $currentRead, 1)
         If StringInStr($currentRead, "Enter current volume label for drive") <> 0 Then
             StdinWrite($ourProcess, DriveGetLabel("f:\") & @CRLF)
             ExitLoop
         EndIf
     EndIf
   EndIf
   $msg = GuiGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $bExit
         ExitLoop
      Case Else
    ;;;
   EndSelect
WEnd
Else
    MsgBox(0,"Error","Drive filesystem is already NTFS!")
EndIf
Exit

Please note i add an inputbox so i can choose which drive to convert since usb stick are not always the same drive on diffrent computers.

Hope someone can help me:)

Regards,

Satanttin

Share this post


Link to post
Share on other sites
orbs

just at first glance, make sure your compiled script is not called "convert.exe", so your Run() statement will not launch itself instead of the real convert.exe tool.

Share this post


Link to post
Share on other sites
satanttin

Ohhh shit xD i feel stupid right now :')

thanks that helped xD

Share this post


Link to post
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
Sign in to follow this  

×