Jump to content

SystemShellObject Library


Recommended Posts

I want test script VBS object shell.

I writting new code.

-------------------------------------------

Library include: WinSysObjectShell.au3

#include-once ;#include "WinSysObjectShell.au3"
;Object Windows System Shell Library Function
;===========================================
Global $fCommand
Func _RunScript($fCommand)
    Return RunDos("call "&$fCommand)
EndFunc
;===========================================
Global $dCommand
Func _SystemInfoDos($dCommand)
    Return Run(@ComSpec&" /k "& $dCommand, "", @SW_SHOW)
EndFunc
;===========================================
Func _SystemInfoText($dCommand)
    Return Run(@ComSpec&" /c "&$dCommand&" > SysInfo.txt", "", @SW_HIDE)
EndFunc
;===========================================
Global $iURL='Localhost'
Func _PingInfoText($iURL)
    Return Run(@ComSpec&" /c Ping "&$iURL&" > PingInfo.txt", "", @SW_HIDE)
EndFunc
;============================================
Global $hURL='Localhost'
Func _PingInfoDos($hURL)
    Return Run(@ComSpec&" /k Ping "&$hURL, "", @SW_SHOW)
EndFunc
;============================================
Global $sCommand, $IntWindowStyle, $bWaitOnReturn
Func _Run($sCommand, $IntWindowStyle=0, $bWaitOnReturn=False)
Dim $oAutoIt = ObjCreate("WScript.Shell")
Return $oAutoIt.Run($sCommand, $IntWindowStyle, $bWaitOnReturn )
EndFunc
;============================================
Global $sCommand
Func RunDos($sCommand)
Return Run(@ComSpec& " /c "&$sCommand, "", @SW_HIDE)
EndFunc
;=================================================
Global $Text, $Title, $TimeOut=0, $Flag
Func _Popup($Text, $Title, $Flag)
Dim $oAutoIt = ObjCreate("WScript.Shell")
Return $oAutoIt.Popup($Text, $TimeOut, $Title, $Flag)
EndFunc
;==============================================================
Global $Path
Func _CreateFolder($Path)
    Dim $oAutoIt = ObjCreate("Scripting.FileSystemObject")
    Return $oAutoIt.CreateFolder(FileGetShortName($Path))
EndFunc
;==============================================================
Global $Source, $Destination, $OverWrite
Func _CopyFolder()
Dim $oAutoIt = ObjCreate("Scripting.FileSystemObject")
    Return $oAutoIt.CopyFolder(FileGetShortName($Source), FileGetShortName($Destination), $OverWrite)
EndFunc
;=============================================================
Global $DirSpec
Func _FolderGetSize($DirSpec)
   Local $fso = ObjCreate("Scripting.FileSystemObject")
   Local $f = $fso.GetFolder(FileGetShortName($DirSpec))
   Return $f.size
EndFunc
;=============================================================
Global $FileSpec
Func _FileGetSize($FileSpec)
   Local $fso = ObjCreate("Scripting.FileSystemObject")
   Local $f = $fso.GetFile(FileGetShortName($FileSpec))
   Return $f.size
EndFunc
;==============================================================
Global $Source, $Destination, $OverWrite
Func _CopyFile($Source, $Destination, $OverWrite=True)
    Dim $oAutoIt = ObjCreate("Scripting.FileSystemObject")
    Return $oAutoIt.CopyFolder(FileGetShortName($Source), FileGetShortName($Destination), $OverWrite)
EndFunc
;==============================================================
Global $FolderSpec, $Force
Func _DeleteFolder($FolderSpec, $Force=False)
Dim $oAutoIt = ObjCreate("Scripting.FileSystemObject")
Return $oAutoIt.DeleteFolder(FileGetShortName($FolderSpec), $Force)
EndFunc
;===============================================================
Global $FileSpec, $Force
Func _DeleteFile($FileSpec, $Force=False)
Dim $oAutoIt = ObjCreate("Scripting.FileSystemObject")
Return $oAutoIt.DeleteFile(FileGetShortName($FileSpec), $Force)
EndFunc
;===============================================================
Global $DriveSpec
Func _DriveExists($DriveSpec)
Dim $oAutoIt = ObjCreate("Scripting.FileSystemObject")
Return $oAutoIt.DriveExists(FileGetShortName($DriveSpec))
EndFunc
;===============================================================
Global $FolderSpec
Func _FolderExists($FolderSpec)
Dim $oAutoIt = ObjCreate("Scripting.FileSystemObject")
Return $oAutoIt.FolderExists(FileGetShortName($FolderSpec))
EndFunc
;===============================================================
Global $FileSpec
Func _FileExists($FileSpec)
Dim $oAutoIt = ObjCreate("Scripting.FileSystemObject")
Return $oAutoIt.FileExists(FileGetShortName($FileSpec))
EndFunc

Download: Code sample Click here

Edited by Laymanball

My Sample Script

Download: VistaDesktopIconsChangerForXp.au3 (Com,Doc and Bin only) http://www.4shared.com/rar/NMHYL5Igba/VistaDesktopIconsChangerForXp_.html

                     VistaDesktopIconsChangerForXp.exe (Resources) http://www.4shared.com/rar/nzs7Mb1gba/VistaDesktopIconsChangerForXp_.html

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