Jump to content

Convert to ntfs exe problem


 Share

Go to solution Solved by orbs,

Recommended Posts

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

Link to comment
Share on other sites

  • Solution

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.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

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...