Jump to content
Sign in to follow this  
botanic

StdOutRead returns number?

Recommended Posts

For some reason I only get a number from that function (increasing with each run command)

I believe the problem is most likely here

if $msg = $okbutton Then

$return = Run('"c:\BLPaletter" "' & $file &'"' , "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD)

StdOutRead($return)

MsgBox(0, $return, '"C:\BLPaletter.exe" "' & $file &'"')

EndIf

however here is thw whole script so far...

#include <GUIConstants.au3>
#include <Constants.au3>

FileInstall("C:\winchm\BLPaletter.exe", "C:\")
FileInstall("C:\winchm\tga.jpg", "C:\tga.jpg")
FileInstall("C:\winchm\BLPaletter.gif", "C:\BLPaletter.gif")
FileInstall("C:\winchm\sample.chm", "C:\BLPaletterHELP.chm")

sleep(10)

Global $defaultstatus = "Ready", $return
Global $status, $dir, $pic, $method = 0

GUICreate("BLPalleter BLPgui by botanic",300,160)
$filemenu = GUICtrlCreateMenu ("&File")
$fileitem = GUICtrlCreateMenuitem ("Open",$filemenu)
GUICtrlSetState(-1,$GUI_DEFBUTTON)
$batchitem = GUICtrlCreateMenuitem ("Open Batch",$filemenu)
$recentbatchmenu = GUICtrlCreateMenu ("Recent Batch",$filemenu,1)
$helpmenu = GUICtrlCreateMenu ("Help") 
$webpage = GUICtrlCreateMenuitem ("Help",$helpmenu)
$infoitem = GUICtrlCreateMenuitem ("About BLPaletter",$helpmenu)
$exititem = GUICtrlCreateMenuitem ("Exit",$filemenu)
$recentfilesmenu = GUICtrlCreateMenu ("Recent Files",$filemenu,1)

$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2)    ; create a separator line

$viewmenu = GUICtrlCreateMenu("View",-1,1)  ; is created before "?" menu
$viewstatusitem = GUICtrlCreateMenuitem ("Statusbar",$viewmenu)
GUICtrlSetState(-1,$GUI_CHECKED)
$okbutton = GUICtrlCreateButton ("CONVERT",60,97,180,20)
GUICtrlSetState(-1,$GUI_FOCUS)
$Preview = GUICtrlCreateLabel ("Preview",15,76)
$statuslabel = GUICtrlCreateLabel ($defaultstatus,0,122,300,16,BitOr($SS_SIMPLE,$SS_SUNKEN))
$preset = GUICtrlCreateCombo("-Standard", 78, 20, 100)
$preset1 = GUICtrlSetData($preset, "-Icon")
$preset2 = GUICtrlSetData($preset, "-Loadscreen")
$preset3 = GUICtrlSetData($preset, "-Skin")
$preset4 = GUICtrlSetData($preset, "-Custom")
$Preview = GUICtrlCreateLabel ("Preset Modes",78,3, "","","",$WS_EX_TRANSPARENT)
$p = GUICtrlCreateCombo("-Paletted", 183, 20, 100)
$p = GUICtrlSetData($p, "-JPG")
$Preview1 = GUICtrlCreateLabel ("Compression Mode",183,3, "","","",$WS_EX_TRANSPARENT)
$Preview2 = GUICtrlCreateLabel ("# of Mipmaps",183,50, "","","",$WS_EX_TRANSPARENT)
$mip = GUICtrlCreateInput ("10",198,70, 50, 20)
$mip = GUICtrlCreateUpdown($mip)
GUICtrlSetLimit($mip,10,1)
$pic = GUICtrlCreatePic("C:\BLPaletter.gif",0,0, 75,75 )
$Preview12 = GUICtrlCreateLabel ("Quality",115,50, "",19,"",$WS_EX_TRANSPARENT)
$quality = GUICtrlCreateInput ("256",104,70, 60, 20)
$quality = GUICtrlCreateUpdown($quality)
GUICtrlSetLimit($quality,256,1)


GUISetState ()
While 1
    $msg = GUIGetMsg()
    
    
    If $msg = $fileitem Then
        
        $file = FileOpenDialog("Choose file...",@DesktopCommonDir,"Images (*.jpg;*.tga;*.jpeg;*.bmp)")
        If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentfilesmenu)
        $dir = FileGetLongName($file)
        if StringRight($dir, 3) = "tga" then
        $pic = GUICtrlSetImage ($pic, "C:\tga.jpg")
        GUICtrlSetState($pic, $GUI_SHOW)
        Else
        $pic = GUICtrlSetImage ($pic, $dir)
        GUICtrlSetState($pic, $GUI_SHOW)
    EndIf
    $method = 1
    EndIf 
        
    If $msg = $batchitem Then
        $file = FileSelectFolder("Choose file...","c:/","All (*.*)")
        If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentbatchmenu)
        $dir = FileGetLongName($file)
        GUICtrlCreatePic($dir,0,0, 75,75 )
        GUICtrlSetState($pic, $GUI_SHOW)
        $method = 2
    EndIf   
    If $msg = $viewstatusitem Then
        If BitAnd(GUICtrlRead($viewstatusitem),$GUI_CHECKED) = $GUI_CHECKED Then
            GUICtrlSetState($viewstatusitem,$GUI_UNCHECKED)
            GUICtrlSetState($statuslabel,$GUI_HIDE)
        Else
            GUICtrlSetState($viewstatusitem,$GUI_CHECKED)
            GUICtrlSetState($statuslabel,$GUI_SHOW)
        EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop
    If $msg = $infoitem Then 
        $sScrollText = 'BLPaletter By:' & @CRLF & _
        'PitzerMike' & @CRLF & _
        ' ' & @CRLF & _
        'BLPgui Created By:' & @CRLF & _
        'Botanic' & @CRLF & _
        ' ' & @CRLF & _
        'Special Thanks To' & @CRLF & _
        'www.wc3campaigns.net' & @CRLF & _
        ' ' & @CRLF 
        $sMain = GUICreate("BLPaletter AND BLPgui", 270 ,150,-1,-1)
        GUISetBkColor(0x000000)

        GUISetFont(12,400,0,"Verdana")

        $sLabel = GUICtrlCreateLabel($sScrollText,10,150/3,250,10000,$ES_CENTER)
        GUICtrlSetColor ( $sLabel, 0x00ff18)

        $sTransHeight = 3
        For $x = 0 to 15
            $stemp = GUICreate("",270, $sTransHeight, 0, $sTransHeight * $x ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$sMain)
            GUISetBkColor(0x000000)
            GUISetState()
            WinSetTrans($stemp,"",(255/15)*(-1*($x-15)))
            
        Next
        

        For $x = 0 to 15
            $stemp = GUICreate("",270, $sTransHeight, 0, 147 - ($sTransHeight * $x) ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$sMain)
            GUISetBkColor(0x000000)
            GUISetState()
            WinSetTrans($stemp,"",(255/15)*(-1*($x-15)))
        Next

        GUISetState(@SW_SHOW,$sMain)
        $sTime = TimerInit()

        $sScroll = -105
        $sFirstTime = 1

        While 1
            $nMsg = GUIGetMsg()
            Switch $nMsg
                Case $GUI_EVENT_CLOSE
                    GUIDelete () 
                    ExitLoop
            EndSwitch
            If TimerDiff($sTime) > 30 Then
                $sFirstTime = 0
                $sTime = TimerInit()
                ControlMove($sMain,"",$sLabel,10,(150/3)-$sScroll)
                $sScroll += 1
                if (150/3)-$sScroll = -150 then $sScroll = -105
            EndIf
        WEnd
        EndIf
        If $msg = $webpage then ShellExecute("BLPaletterhelp.chm", @ScriptDir)
            
        if $msg = $okbutton Then
            $return = Run('"c:\BLPaletter" "' & $file &'"' , "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD)
            StdOutRead($return)
            MsgBox(0,  $return, '"C:\BLPaletter.exe" "' & $file &'"')
        EndIf
WEnd
FileDelete("C:\BLPaletter.exe")
FileDelete("C:\BLPaletterHELP.chm")
FileDelete("C:\tga.jpg")
FileDelete("C:\BLPaletter.gif")
GUIDelete()
Exit


;FileSelectFolder("Please Select the input Batch folder", "")
;FileSelectFolder("Please Select the Output folder", "")
;FileOpenDialog("Please select the location of the BLPalleter program", "","All (BLPaletter.exe)")

Share this post


Link to post
Share on other sites

$return = Run('"c:\BLPaletter" "' & $file &'"' , "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD)

$STD = StdOutRead($return)

MsgBox(0, $STD, '"C:\BLPaletter.exe" "' & $file &'"')

Edit: The $return variable is the PID (Process Identifier) number of the running process

Edited by smashly

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  

×
×
  • Create New...