Sign in to follow this  
Followers 0
failedtocompile

FileInstall problems :(

4 posts in this topic

Hello

I am having alot of problems with FileInstall, I thought I had it working few days ago, as it would create the files when script executed to @temp \

Now it does not :) , I was pretty devastated as I have only started with Autoit and with some help thus far with syntax from the forums I was going along nicely.

the 3x files which needed to be installed to users @TempDir

Some.ini

Pro.exe

123.bmp

The script and all the required files are in the same folder, When i compile the script it does report that it is including the files, and eveidence of that is when i rename one of the files to include.

My Current Code. (I have chopped out some code for privacy issues but this is 98% of the code)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiToolTip.au3>
#include <file.au3>

TraySetState(2) ; hides system tray icon

;Creates log file of users who have used this utility
$Logfile = "\\server01\usage.log" 
FileWriteLine($Logfile, "Date & Time::" & " "  & @MDAY & "/" & @MON & " " & @HOUR & ":" & @MIN & " "  & "ComputerName::" _
& " " & @ComputerName & " " & "UserName::" & " " & @UserName)

FileInstall("123.bmp", @TempDir & "\123.bmp\",1)
FileInstall("PRO.exe", @TempDir & "\PRO.exe\",1)
FileInstall("some.INI", @TempDir & "\some.INI\",1)


$MyHomeShare = EnvGet("HomeShare")
$ProcessName1 = "" 
$ProcessName2 = ""
$ProcessName3 = ""
$Proflwiz = @TempDir & "\PRO.exe"
$file1 = "H:\Officebkup\Officebkup.txt"

$Form1 = GUICreate("", 401, 221, 320, 221)
$Bkgrnd = GUICtrlCreatePic(@TempDir & "\123.bmp", 0, 0, 400, 220, $WS_CLIPSIBLINGS)
$Btn_bkup = GUICtrlCreateButton("$Btn_bkup", 9, 168, 82, 41, BitOR($WS_CLIPSIBLINGS, $BS_FLAT))
$Btn_restore = GUICtrlCreateButton("$Btn_restore", 315, 168, 73, 41, BitOR($WS_CLIPSIBLINGS, $BS_FLAT))
$Btn_exit = GUICtrlCreateButton("$Btn_exit", 333, 0, 82, 37, BitOR($WS_CLIPSIBLINGS, $BS_FLAT))
$Btn_1 = GUICtrlCreateButton("$Btn_1", 17, 0, 97, 33, BitOR($WS_CLIPSIBLINGS, $BS_FLAT))
$Btn_2 = GUICtrlCreateButton("Btn_2", 17, 52, 97, 36, BitOR($WS_CLIPSIBLINGS, $BS_FLAT))

GUICtrlSetTip($Btn_restore, "")
            
GUICtrlSetTip($Btn_bkup, "")

GUICtrlSetTip($Btn_exit, " Exit ")

GUICtrlSetTip($Btn_1, "")
                
GUICtrlSetTip($Btn_2, "")
GUISetState(@SW_SHOW)

;Check for a vaild drive mapping if not exisit then displays error and terminates utility, if valid Drive then displays splashscreen
$Drivemap = DriveGetType("H:\")
If Not @Error Then
SplashTextOn("", "", 400, 200, -1, -1, 1, "", 20)
Sleep(4500)
SplashOff()

ElseIf @Error Then 
    SplashTextOn("", "", 280, 185, -1, -1, 1, "", 17)
Sleep(6000)
SplashOff()
Exit
EndIf

While 1
    Sleep(30)
    Switch GUIGetMsg()

        Case $Btn_bkup
            If ProcessExists($ProcessName1) Then    ; Checking for running process
                MsgBox(0, "", "" & "  .")
            ElseIf ProcessExists($ProcessName2) Then    ; Checking for running process
                MsgBox(0, "", "" &"   .")
            ElseIf ProcessExists($ProcessName3) Then    ; Checking for running process
                MsgBox(0, "", "" &"  .")

            ElseIf FileExists($file1) Then
                $Filemsgbox =MsgBox(0x1, "", "",13)
                If $Filemsgbox =1 Then RunWait('"' & $Proflwiz & '" /q /f /s "' & $file1 &'"')
                Else 
                    RunWait('"' & $Proflwiz & '" /q /f /s "' & $file1 &'"')
                    
            EndIf

Thanks in advance for any help you can provide.

Share this post


Link to post
Share on other sites



Take out those trailing backslashes, or the file names will be treated as directories.

FileInstall("123.bmp", @TempDir & "\123.bmp",1)
FileInstall("PRO.exe", @TempDir & "\PRO.exe",1)
FileInstall("some.INI", @TempDir & "\some.INI",1)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Take out those trailing backslashes, or the file names will be treated as directories.

FileInstall("123.bmp", @TempDir & "\123.bmp",1)
FileInstall("PRO.exe", @TempDir & "\PRO.exe",1)
FileInstall("some.INI", @TempDir & "\some.INI",1)

Thanks so much Skruge, that has worked.

The odd thing is if I leave the trailing \ and put some of the code into a blank script and run it, it works.

also in the helpfile i was looking at

dest: The destination path of the file with trailing backslash if only the directory is used. This can be a variable.

So i must of got mixed up there.

Share this post


Link to post
Share on other sites

Thanks so much Skruge, that has worked.

The odd thing is if I leave the trailing \ and put some of the code into a blank script and run it, it works.

also in the helpfile i was looking at

dest: The destination path of the file with trailing backslash if only the directory is used. This can be a variable.

So i must of got mixed up there.

Were you running it without compiling? If so, FileInstall calls are translated into FileCopy, which will work with a backslash at the end.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
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
Sign in to follow this  
Followers 0