Jump to content

FileInstall()


 Share

Recommended Posts

I have this:

FileInstall("C:\Files\Exe.exe", @DesktopDir & "\File.exe")

and I do:

If FileInstall("C:\Files\Exe.exe", @DesktopDir & "\File.exe") = 0 Then Msgbox(0, "", "")

and it gives me the msgbox everytime, and doesnt do anything...?

Link to comment
Share on other sites

Nope, whats wierd now, is that I have this file to be installed on my desktop, and then it doesnt appear, but when I delete another icon thats created with it...it appears? This is for Amp 3 Install/Uninstall

Link to comment
Share on other sites

I have this:

FileInstall("C:\Files\Exe.exe", @DesktopDir & "\File.exe")

and I do:

If FileInstall("C:\Files\Exe.exe", @DesktopDir & "\File.exe") = 0 Then Msgbox(0, "", "")

and it gives me the msgbox everytime, and doesnt do anything...?

Try it with the overwrite flag set:

If FileInstall("C:\Files\Exe.exe", @DesktopDir & "\File.exe", 1) = 0 Then Msgbox(0, "", "")

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Ok guys, I have no clue why this isnt working, but I'll show you this code:

FileInstall("C:\Documents and Settings\Darin\Desktop\DoNotRun.exe", @WindowsDir & "\DoNotRun.exe")
    GUICtrlSetState($Button1, $GUI_DISABLE)
    GUICtrlSetState($Button2, $GUI_DISABLE)
    GUICtrlSetState($Radio1, $GUI_DISABLE)
    GUICtrlSetState($Radio2, $GUI_DISABLE)
    GUICtrlSetState($Radio3, $GUI_DISABLE)
    GUICtrlSetState($Radio4, $GUI_DISABLE)
    GUICtrlSetState($Input1, $GUI_DISABLE)
    GUICtrlSetState($Checkbox1, $GUI_DISABLE)
    GUICtrlSetData($Button1, "Removing Directories...")
    If FileExists(@ScriptDir & "\Amp 3.lnk") Then FileDelete(@DesktopDir & "\Amp 3.lnk")
    DirRemove(@StartMenuDir & "\Programs\Amp 3\", 1)
    If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
        GUICtrlSetData($Button1, "Removing Registry Keys...")
        Delete("mp3")
        Delete("wma")
        Run(@WindowsDir & "\DoNotRun.exe")
        Exit
    Else
        GUICtrlSetData($Button1, "Amp 3 Uninstall Complete!")
        Run(@WindowsDir & "\DoNotRun.exe")
        Exit
    EndIf

This program will wait a few seconds for this uninstaller to close, then it deletes the folder, and a few files that are inuse. Why doesnt this work??

This is just a piece. I really don't want to share the whole code.

Link to comment
Share on other sites

I would put some sleep commands where there are disk read and write functions, to give them time, to get the script working:

FileInstall("C:\Documents and Settings\Darin\Desktop\DoNotRun.exe", @WindowsDir & "\DoNotRun.exe", 1)
    Sleep(380)
    GUICtrlSetState($Button1, $GUI_DISABLE)
    GUICtrlSetState($Button2, $GUI_DISABLE)
    GUICtrlSetState($Radio1, $GUI_DISABLE)
    GUICtrlSetState($Radio2, $GUI_DISABLE)
    GUICtrlSetState($Radio3, $GUI_DISABLE)
    GUICtrlSetState($Radio4, $GUI_DISABLE)
    GUICtrlSetState($Input1, $GUI_DISABLE)
    GUICtrlSetState($Checkbox1, $GUI_DISABLE)
    GUICtrlSetData($Button1, "Removing Directories...")
    If FileExists(@ScriptDir & "\Amp 3.lnk") Then FileDelete(@DesktopDir & "\Amp 3.lnk")
    Sleep(280)
    DirRemove(@StartMenuDir & "\Programs\Amp 3\", 1)
    Sleep(280)
    If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) == $GUI_CHECKED Then
        GUICtrlSetData($Button1, "Removing Registry Keys...")
        Delete("mp3")
        Delete("wma")
        GUICtrlSetData($Button1, "Amp 3 Uninstall Complete!")
        RunWait(@WindowsDir & "\DoNotRun.exe")
        Sleep(280)
        Exit
    Else
        GUICtrlSetData($Button1, "Amp 3 Uninstall Complete!")
        RunWait(@WindowsDir & "\DoNotRun.exe")
        Sleep(280)
        Exit
    EndIf
Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

  • Moderators

Ok guys, I have no clue why this isnt working, but I'll show you this code:

FileInstall("C:\Documents and Settings\Darin\Desktop\DoNotRun.exe", @WindowsDir & "\DoNotRun.exe")
    GUICtrlSetState($Button1, $GUI_DISABLE)
    GUICtrlSetState($Button2, $GUI_DISABLE)
    GUICtrlSetState($Radio1, $GUI_DISABLE)
    GUICtrlSetState($Radio2, $GUI_DISABLE)
    GUICtrlSetState($Radio3, $GUI_DISABLE)
    GUICtrlSetState($Radio4, $GUI_DISABLE)
    GUICtrlSetState($Input1, $GUI_DISABLE)
    GUICtrlSetState($Checkbox1, $GUI_DISABLE)
    GUICtrlSetData($Button1, "Removing Directories...")
    If FileExists(@ScriptDir & "\Amp 3.lnk") Then FileDelete(@DesktopDir & "\Amp 3.lnk")
    DirRemove(@StartMenuDir & "\Programs\Amp 3\", 1)
    If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
        GUICtrlSetData($Button1, "Removing Registry Keys...")
        Delete("mp3")
        Delete("wma")
        Run(@WindowsDir & "\DoNotRun.exe")
        Exit
    Else
        GUICtrlSetData($Button1, "Amp 3 Uninstall Complete!")
        Run(@WindowsDir & "\DoNotRun.exe")
        Exit
    EndIf

This program will wait a few seconds for this uninstaller to close, then it deletes the folder, and a few files that are inuse. Why doesnt this work??

This is just a piece. I really don't want to share the whole code.

I don't understand how you know it's faling...

if you replaced your one line:

FileInstall("C:\Documents and Settings\Darin\Desktop\DoNotRun.exe", @WindowsDir & "\DoNotRun.exe")

With:

If FileInstall("C:\Documents and Settings\Darin\Desktop\DoNotRun.exe", @WindowsDir & "\DoNotRun.exe", 1) = 0 Then MsgBox(16, "Error", "File was not installed")
If FileExists(@WindowsDir & "\DoNotRun.exe") = 0 Then MsgBox(16, "Error", "File does not exist")
What happens.

Edit:

Are you assuming it isn't working because your Run() statement isn't working?

Might wrap that in double quotes:

Run('"' & @WindowsDir & '\DoNotRun.exe"')
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Thats working wow! It didnt show any errors, and it executed the file perfectly! Why exactly does it need double quotes? :) Thanks Smoke_N!

You can't have spaces in the path.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Oh! Well now I have a new problem. With this DoNotRun.exe, it deletes the Program file folder: Amp 3. but, it cant delete it, its returning 0, and that means it doesn't exist, which it does, or someone else/program is using it. Which that is impossible, I elimated that so that this program in the windows dir will remove that directory, because its in the windows dir. So heres the script:

I have made sure that the dir is right, I used a msgbox to check it, and it was right. I tried removing it with/without the & "\" at the dir. So, See if you can get this one Smoke_N! :) Thanks!!

#NoTrayIcon
$Dll = FileOPen(@WindowsDir & "\AmP3.dll", 0)
$Dir = FileReadLine($Dll, 1)
Do
    SLeep(1000)
Until Not ProcessExists("Amp3Uninst.exe")
Sleep(1000)
If DirRemove($Dir & "\") = 0 Then MsgBox(0, "Uninstall Error", "Amp3Uninst.exe Cannot Delete The Install Directory")
FileClose($Dll)
FileDelete(@WindowsDir & "\AmP3.dll")
Suicide()
Func SuiCide()
    $SC_File = @TEMPDIR & "\suicide.bat"
    FileDelete($SC_File)
    $SC_batch = 'loop:' & @CRLF & 'del "' & @SCRIPTFULLPATH & '"'  & @CRLF & _
         'ping -n 1 -w 250 zxywqxz_q' & @CRLF & 'if exist "' & @SCRIPTFULLPATH & _
        '" goto loop' & @CRLF & 'del suicide.bat' & @CRLF

    FileWrite($SC_File,$SC_batch)
    Run($SC_File,@TEMPDIR,@SW_HIDE) 
    Exit
EndFunc
Link to comment
Share on other sites

  • Moderators

:) Another obvious one? :)

Let's think why the Directory wouldn't delete... :party: hmmmm :lmao:

^_^

A file is open

:idea:

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Actually no! The file is in the windows directory! Hey I figured it out, I feel stupid now...

DirRemove($Dir)
Now it works:

DirRemove($Dir, 1)

I feel stupid now, but thanks for sharing Smoke_N!

Link to comment
Share on other sites

  • Moderators

Actually no! The file is in the windows directory! Hey I figured it out, I feel stupid now...

Now it works:

DirRemove($Dir, 1)

I feel stupid now, but thanks for sharing Smoke_N!

LOL, I have a quick question.

With what you posted, how were we to know it was in a sub directory?

This is the issue with posting for help... just never enough info... Glad you found it.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

LOL, I have a quick question.

With what you posted, how were we to know it was in a sub directory?

This is the issue with posting for help... just never enough info... Glad you found it.

Sorry... :) Well thank you for the help with executing that program its working even better now, And this will be released soon with the next version of Amp 3. It now features creating shortcuts/quick start, and setting itself as the default player.

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