Jump to content

Vista Theme moves GUI ; Filecopy with UAC?


Recommended Posts

First of all, Hi@all (first post :D )

Thanks for the good FAQ, where i found some of my questions answerd already. but 2 problems stil trouble me, and i hope to find some help.

This is my first tryout with AutoIt, a customizable Install-Script. Put script and portable programs in a folder (USB-stick or CD/DVD), describe path and Name of the application in a INI-file and use the script to install the portables from the folder to the local machine, including links on the desktop.

i got it working the way i wanted, even there are still some feature i need to make better or include.

1. problem: if useing vista with aero design (might happen also with other designs than "normal style") then the GUI shifts the buttons and checkbuttons, so that some of the items even shift out of visible range.

Question: can i force the GUI to appear in a specific design, in order to let it appear equal in all windows-versions and -designs

2. problem: once selected the applications to install/copy and pressed "install", all files will be copied to the selected destination folder. vista with enabled UAC does not copy anything.

Question: how can i copy files while UAC is activated?

once finished i realy would like to share the finished "Portable Installer" here :o

thanks for any help or idea!

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         hellcoder
 Script Function: Installscript for Portables

#ce ----------------------------------------------------------------------------

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)
Opt("GUICoordMode", 2)

Global $FolderTarget, $InstallPath, $file, $var, $portable, $count, $inivalue, $checkPP, $pathPP, $arrayPP[50], $checkCN, $DesktopLink

PortableList()

Func PortableList()
    Local $btn01, $msg, $SelectTarget, $widthCell
    GUICreate("Portable Installer 1.0             by Helmut Giersch") ; will create a dialog box that when displayed is centered
$InstallPath = @ProgramFilesDir&"\portables"    
$file = FileOpen("files.ini", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open files.ini.")
    Exit
EndIf

$portable = IniRead("files.ini", "Settings", "Portables", "NotFound"); collect information from the files.ini about nr. of Portables
$count = $portable
$portable = 0
$widthCell = 200
$checkCN = GUICtrlCreateLabel("Portables :", 10, 10, $widthCell)
$checkCN = GUICtrlCreateLabel("", 0, 0)

While $portable <= ($count - 1); collect information from the files.ini and list the Portables
    $var = IniRead("files.ini", $portable, "OnScreen", "NotFound")
    $pathPP = IniRead("files.ini", $portable, "Path", "NotFound")
    If @error = -1 Then ExitLoop
    if ($portable - ( 2 * Int($portable / 2 ) ) ) = 0 Then
        $arrayPP[$portable] = GUICtrlCreateCheckbox($var, -2 * $widthCell, 0)
    Else
        $arrayPP[$portable] = GUICtrlCreateCheckbox($var, 0, -1)
    EndIf
    $portable = $portable + 1   
Wend

Opt("GUICoordMode", 1)
    $DesktopLink = GUICtrlCreateCheckbox("Automatisch Links auf dem Desktop erstellen", 10, 330, 300, 20)   
    $btn01 = GUICtrlCreateButton("Install", 10, 355, 70, 20)    
    $SelectTarget = GUICtrlCreateButton("...", 82, 355, 20, 20) 
    $FolderTarget = GUICtrlCreateLabel($InstallPath, 105, 360, 220, 20) 
    
GUISetState()     ; will display the dialog box with checkboxes

   ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE; exit the loop and then the program
                ExitLoop
            Case $msg = $btn01
                StartInstall()  ; will start install routine
            Case $msg = $SelectTarget
                SelectFolder()  ; select the folder for installation
                $FolderTarget = GUICtrlCreateLabel($InstallPath, 105, 300, 220, 20) 
        EndSelect
    WEnd
EndFunc   ;==>PortableList

Func SelectFolder();  Select the target folder for installation
    $InstallPath = FileSelectFolder("Select Target Folder...", @ProgramFilesDir, 1)
EndFunc ;==SelectFolder

Func StartInstall()
    $portable = 0
    While $portable <= ($count - 1); collect information from the files.ini and list the Portables
        If BitAnd(GUICtrlRead($arrayPP[$portable]),$GUI_CHECKED)  = $GUI_CHECKED Then
            $var = IniRead("files.ini", $portable, "Path", "NotFound")
            $checkCN = GUICtrlCreateLabel("Portable wird kopiert : "&$var, 40, 325, 300, 20)
            DirCopy(".\portables\"&$var, $InstallPath & "\"& $var, 1)
            If BitAnd(GUICtrlRead($DesktopLink),$GUI_CHECKED)  = $GUI_CHECKED Then FileCopy(".\Portables\" & $var & "\*.lnk", @DesktopDir, 0)
        EndIf       
        $portable = $portable + 1       
    WEnd
    $checkCN = GUICtrlCreateLabel("Installation abgeschlossen!", 40, 325, 300, 20)
    FileClose($file)
    MsgBox(0, "Finished!", "Die Installation wurde abgeschlossen")
    Exit
EndFunc ;==StartInstall
Link to comment
Share on other sites

Welcome to the forums :D

1. You might want to take a look at xskin, other than that type of skinning, you can't do much but to actually design so it works on all versions.

2. Add #RequireAdmin to your script.

Thanks for the quick answer @ monoceres ! i will try the #RequireAdmin asap. i just took a look at xskin you mentioned... looks good, seems to have all i need. i'll be back ...

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