Jump to content
faustf

Console write not write o_O

Recommended Posts

faustf

hi guys i have a this script :

#RequireAdmin
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIFiles.au3>
#include <File.au3>
#include <Date.au3>
#include <FileConstants.au3>
#include <Process.au3>

_ShadowCopyON()

Func _ShadowCopyON()
    Local $iFileExists = FileExists(@SystemDir & "\WindowsPowerShell")
    If $iFileExists Then
        ;RunWait(@ComSpec & ' /k powershell.exe -executionpolicy AllSigned  -File ShadowCopyAttach.ps1' )
        RunWait(@ComSpec & ' /c wmic shadowcopy call create Volume=C:\ > C:\temp\ShadowID.txt')
        ;Local $avav=_True_ReadFile("C:\temp\ShadowID.txt", 0)
        Local $sLShadowResult = _True_ReadFile("c:\temp\ShadowID.txt", 0)
        Local $aLDirtyShadow = StringSplit($sLShadowResult, '"')
        $sGIdRig = _StringTrimLefTeRight($aLDirtyShadow[2], '1', '1')

        RunWait(@ComSpec & ' /c vssadmin list shadows > C:\temp\ShadowList.txt')
        Local $aLShadowListT = FileReadToArray("c:\temp\ShadowList.txt")

        ;_ArrayDisplay($aLShadowListT)
        Local $sLPathVolume
        For $i = 0 To UBound($aLShadowListT) - 1
            Local $iPosition = StringInStr($aLShadowListT[$i], $sGIdRig)
            If $iPosition <> 0 Then
                $sLPathVolume = $aLShadowListT[($i + 2)]
            EndIf
        Next
        MsgBox(0, '', $sLPathVolume)
        ConsoleWrite($sLPathVolume)
        Local $sLShadowCopyVolume = _StringTrimLefTeRight($sLPathVolume, 28, 0)
        ConsoleWrite($sLShadowCopyVolume)
        MsgBox(0, '', 'mklink /d c:\temp\freezer_shadowcopy ' & $sLShadowCopyVolume)
        RunWait(@ComSpec & ' /k mklink /d c:\temp\freezer_shadowcopy ' & $sLShadowCopyVolume)

    Else
        MsgBox($MB_SYSTEMMODAL, "", "Windows Powershell non esiste devi scaricarlo" & @CRLF & "FileExist returned: " & $iFileExists)
        ShellExecute("https://www.microsoft.com/it-IT/download/confirmation.aspx?id=16818") ; powershell download for windows xp
    EndIf
EndFunc   ;==>_ShadowCopyON


Func _StringTrimLefTeRight($string, $CountLeft = 0, $CountRight = 0)
    If $CountLeft = Default Then $CountLeft = 0
    If $CountRight = Default Then $CountRight = 0

    Local $sLIdLeft = StringTrimLeft($string, $CountLeft)
    Local $sLIdRig = StringTrimRight($sLIdLeft, $CountRight)
    Return $sLIdRig
EndFunc   ;==>_StringTrimLefTeRight

Func _True_ReadFile($sFilePath, $attribute)
    Local $hFileOpen = FileOpen($sFilePath, $attribute)
    If $hFileOpen = -1 Then
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.")
        Return False
    EndIf
    Local $sFileRead = FileRead($hFileOpen)
    FileClose($hFileOpen)
    Return $sFileRead
EndFunc   ;==>_True_ReadFile

i insert some consolwrite but not  write nothing , but  msgbox  before work  , how is possible?? O_O  

thankz at all

Share this post


Link to post
Share on other sites
faustf

this is my output

>"C:\Program Files\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\SviluppoGest\Documents\Programmazione\Autoit\Develop\backup_pino\BackuPinoVwmic.au3" /UserParams    
+>10:27:18 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0   Keyboard:00000410  OS:WIN_7/Service Pack 1  CPU:X86 OS:X86  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files\AutoIt3\SciTE   UserDir => C:\Users\SviluppoGest\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\SviluppoGest\AppData\Local\AutoIt v3\SciTE 
! Your script requires Admin rights while SciTE is running at normal level.
! This means no Console output from the script will be displayed and SciTE will show the script as ended right away.
>Running AU3Check (3.3.14.2)  params:-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7  from:C:\Program Files\AutoIt3  input:C:\Users\SviluppoGest\Documents\Programmazione\Autoit\Develop\backup_pino\BackuPinoVwmic.au3
+>10:27:19 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\SviluppoGest\Documents\Programmazione\Autoit\Develop\backup_pino\BackuPinoVwmic.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>10:27:20 AutoIt3.exe ended.rc:0
+>10:27:20 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 2.573

yea

Share this post


Link to post
Share on other sites
rudi

Hi.

From your output:

 

! Your script requires Admin rights while SciTE is running at normal level.
! This means no Console output from the script will be displayed and SciTE will show the script as ended right away.

 

Start SciTE using "Run as Administrator", then you will get the output as you expect.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
Jos
Posted (edited)

I guess that was my point and we have been pointing out now for a long time that some have a hard time reading before asking and @faustf have been a prime example of this.
I fully appreciate the fact that not everybody is a programmer, but after being around for this long and having asked this many question where over and over again being pointed to RTFM  or like in this case simply first READ, it really feels you are simply lazy and just burb the questions out in stead of putting in any effort to resolve it yourself.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×