Jump to content

Console write not write o_O


Recommended Posts

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

Link to comment
Share on other sites

  • Developers

.. so you get the UAC prompt for this script and then the SciTE outputpane tells you the script ended .... right?

Jos

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

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • Developers

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

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

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...