[Blockierte Grafik: http://www.abload.de/img/vhdautoattachju6f.png]
Hallo Leute,
schon lange nicht mehr gehört . Ich hab ein Image Backup gemacht, und ich fand es so mühsam, die VHD Datei anzuhängen, dass ich schnell mal ein Tool geschrieben habe. Und VHD Auto Attach wurde geboren . So, wie funktioniert es? Es gibt 2 EXE Dateien. Die eine wird im Autostart Ordner kopiert. Sie fügt die VHD Datei beim booten immer an. Die zweite ist di Konfigurations Datei. Mit ihr stellt man die INI ein. Man kann auch sofort "attachen". Da kein Ladebalken so präzise ist wie Windows, wird das Konsolenfenster angezeigt. Das wars eigentlich. Außer:
Auf die Plätze, fertig, ATTACH!
Info: VHD Auto Attach
Version: 1.1.0.0
Größe: ca. 1.56 MB
Anhang möglich: Nein
Bugs zu beheben: Noch keine gefunden
Download: Klick!
Update Infos:
Update #1: (V. 1.0.1)
Spoiler anzeigen
Speed Attach:
1.) Hauptprogramm öffnen
2.) Auf "Speed Attach Activating" klicken
3.) Auf VHD Rechtsklick und dann VHD Speed Attach
4.) Wird dann attached!
Außerdem:
Das schließen vom CMD Fenster passiert, wenn das Attaching fertig ist. Vorher war es nicht so (Sleep)
Update #2: (V. 1.1)
Spoiler anzeigen
.Icons
.Besserer Überblick
.Kontextmenü Speed Attach und Speed Detach verbessert
.Attach jetzt bei Haupt Programm möglich
.Bugs behoben
Source:
Hauptprogramm:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=VHD Auto Attach 1.1\Icons\Yes.ico
#AutoIt3Wrapper_Outfile=VHD Auto Attach 1.1\VHD Auto Attach.exe
#AutoIt3Wrapper_Outfile_x64=VHDAttachx64.exe
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_Res_Comment=By StevenX Media
#AutoIt3Wrapper_Res_Description=Attach your VHD!
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=(C) StevenX Media 2011
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;---------------------------------------------------------------------
;VHD Auto Attach
;---------------------------------------------------------------------
;Author: Stefan Blagojevic alias StevenX
;.....................................................................
;Version: 1.1
;Open Source
;Please don´t change and save this file under the same name!
;[email='stefan.blagojevic@live.at'][/email]
;....................................................................
;--------------------------------------------------------------------
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("VHD Auto Attach by StevenX Version 1.0 BETA", 461, 252, 193, 122)
$File_Select = GUICtrlCreateButton("Select VHD File", 112, 40, 233, 73)
$OK = GUICtrlCreateButton("OK", 80 , 136, 289, 65)
$Reg = GUICtrlCreateButton( "Speed Attach Activating", -1, 200)
$Attachbutton = GUICtrlCreateButton( "Attach VHD File", 285, 200)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_Copy()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $File_Select
;----------------------Selection for AutoStart VHD File
$Datei = FileOpenDialog( "Select VHD", @ScriptDir, "VHD File (*.*)", 1)
if @error Then
MsgBox( 0+16, "ERROR!", "No File selected!")
EndIf
Case $Attachbutton
;-----------------------------Selection for Attaching
$Datei = FileOpenDialog( "Select VHD", @ScriptDir, "VHD File (*.*)", 1)
_Attach()
Case $OK
$Ini = IniWrite( @MyDocumentsDir & '\StevenX Media\VHDAUTOATTACH\Settings.ini', 'Settings', 'VHDDIR', $Datei)
if $Ini = 1 Then
_Fragen()
EndIf
Case $Reg
;------------------------------For Speed Attaching
FileCopy( @ScriptDir & '\AutoStartFileDoNotOPEN.exe', 'C:\VHDAutoattach\Attach.exe',1)
RegWrite("HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\VHD Speed Attach\","","REG_SZ","VHD Speed Attach");-----------Attaching
RegWrite("HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\VHD Speed Attach\Command","","REG_SZ", @ScriptDir & '\AttachRun.exe UNC %1')
RegWrite("HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\VHD Speed Dettach\","","REG_SZ","VHD Speed Detach");--------------------Attaching
RegWrite("HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\VHD Speed Dettach\Command","","REG_SZ", @ScriptDir & '\DetachRun.exe UNC %1');-----Detaching
EndSwitch
WEnd
Func _Copy()
;----------------------Copying the AutoStart file
$Copy = FileCopy( @ScriptDir & '\Startup.exe', @StartMenuDir & '\Programs\Startup\VHDAUTOATTACH.EXE',1)
If $Copy = 0 Then
MsgBox(0,"ERROR!","Could not copy Autostart file!")
EndIf
EndFunc
Func _Fragen()
$Frag = MsgBox(4+48, "Successful!", "Managed your VHD File! Do you want to attach it now?")
If $Frag = 6 Then
$Attach = IniRead(@MyDocumentsDir & '\StevenX Media\VHDAUTOATTACH\Settings.ini', 'Settings', 'VHDDIR', 'ERROR!!')
_Attach()
EndIf
EndFunc
Func _Attach()
;---------------Attaching function. You will also find this in the file 'Attachrun.au3'
TrayTip( "Starting Attaching...", "VHDAutoAttach starts. Please standby and let the focus on the windows!", 30, 2)
Sleep(2000)
Run( "Diskpart.exe")
Sleep(1000)
Send('list disk {ENTER}')
Send('list volume {ENTER}')
Send('select vdisk file= ' & $Datei & '{ENTER}')
Send('Attach vdisk {ENTER}')
Sleep(1000)
WinClose( "[ACTIVE]","")
EndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]Speed Attach:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=VHD Auto Attach 1.1\Icons\No.ico
#AutoIt3Wrapper_Outfile=VHD Auto Attach 1.1\AttachRun.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$UNC = ""
$UNC_SPLIT = ""
$Result = ""
#Include <Array.au3>
#include <Constants.au3>
TrayTip( "Starting Attaching...", "VHDAutoAttach starts. Please standby and let the focus on the windows!", 30, 2)
Sleep(1000)
$UNC = ""
$UNC_SPLIT = ""
$Result = ""
For $i = 2 to $CmdLine[0] Step 1
$UNC = $UNC & $CmdLine[$i]
if $i <> $CmdLine[0] Then $UNC = $UNC & " "
Next
$UNC_SPLIT = StringSplit($UNC,"\")
[/autoit] [autoit][/autoit] [autoit]if $CmdLine[1] = "UNC" Then
$Result = $UNC_SPLIT[1]
For $i = 2 to UBound($UNC_SPLIT)-1 Step 1
$Result = $Result & "\" & $UNC_SPLIT[$i]
Next
ClipPut($Result)
EndIf
Run( "Diskpart.exe")
Sleep(1000)
Send('list disk {ENTER}')
Send('list volume {ENTER}')
Send('select vdisk file= ' & $Result & '{ENTER}')
Send('Attach vdisk {ENTER}')
Sleep(1000)
WinClose( "[ACTIVE]","")
Speed Detach:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=VHD Auto Attach 1.1\Icons\No.ico
#AutoIt3Wrapper_Outfile=VHD Auto Attach 1.1\DetachRun.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$UNC = ""
$UNC_SPLIT = ""
$Result = ""
#Include <Array.au3>
#include <Constants.au3>
TrayTip( "Starting Detaching...", "VHDAutoAttach starts. Please standby and let the focus on the windows!", 30, 2)
Sleep(1000)
$UNC = ""
$UNC_SPLIT = ""
$Result = ""
For $i = 2 to $CmdLine[0] Step 1
$UNC = $UNC & $CmdLine[$i]
if $i <> $CmdLine[0] Then $UNC = $UNC & " "
Next
$UNC_SPLIT = StringSplit($UNC,"\")
[/autoit] [autoit][/autoit] [autoit]if $CmdLine[1] = "UNC" Then
$Result = $UNC_SPLIT[1]
For $i = 2 to UBound($UNC_SPLIT)-1 Step 1
$Result = $Result & "\" & $UNC_SPLIT[$i]
Next
ClipPut($Result)
EndIf
Run( "Diskpart.exe")
Sleep(1000)
Send('list disk {ENTER}')
Send('list volume {ENTER}')
Send('select vdisk file= ' & $Result & '{ENTER}')
Send('Detach vdisk {ENTER}')
Sleep(1000)
WinClose( "[ACTIVE]","")
Automatic Attach (Attach nach Booten)
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=VHD Auto Attach 1.1\Icons\dont.ico
#AutoIt3Wrapper_Outfile=VHD Auto Attach 1.1\Startup.exe
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
TrayTip( "Starting Attaching...", "VHDAutoAttach starts. Please standby and let the focus on the windows!", 30, 2)
Sleep(2000)
$Attach = IniRead( @MyDocumentsDir & '\StevenX Media\VHDAUTOATTACH\Settings.ini', 'Settings', 'VHDDIR', 'ERROR!!')
Run( "Diskpart.exe")
Sleep(1000)
Send('list disk {ENTER}')
Send('list volume {ENTER}')
Send('select vdisk file= ' & $Attach & '{ENTER}')
Send('Attach vdisk {ENTER}')
Sleep(1000)
WinClose( "[ACTIVE]","")
Wie man es installiert:
Alle Source decompilen und das Hauptprogramm starten. Man muss folgendes beachten:
- Das Auto Attach muss dann "Startup.exe" heißen und imselben Ordner sein wie "VHD Auto Attach.exe", also das Hauptprogramm.
- Speed Attach muss "AttachRun.exe" heißen und auch im selben Ordner sein.
- Speed Detach muss "DetachRun.exe" heißen und auch im selben Ordner sein
Weil es so kompliziert ist, wollte ich ja, dass ihr es fertig öffnet. Aber nein
MFG,
StevenX