Jump to content
Sign in to follow this  
MykeV

Help me close this loop statement

Recommended Posts

MykeV

All, I need some help figuring out how to make this statement work. I'm using AutoIt to silently install a program and setup up some custom program links. Since I can't tell when the installation completes, I figured i would create an "IF" statement that would copy the links to the necessary folders once the program executable existed. I want the "IF" statement to keep repeating until the "FileExist" statement is true. What am i doing wrong.

;Program Install (silent mode)
Run (@WorkingDir & "\8003\setup.exe -s")

;Copying File Links
$C1 = @WorkingDir &  "\misc\dynacomm.lnk"
$C2 = @WorkingDir &  "\misc\session1.ses"
$C3 = @WorkingDir &  "\misc\standard1.*"

While 1
    If FileExists (@ProgramFilesDir &  "\Futuresoft\DCSeries\dseries.exe") Then
        FileCopy ($C1 , @DesktopDir,1)
        FileCopy ($C2 , @ProgramFilesDir &  "\Futuresoft\DCSeries\session",1)
        FileCopy ($C3 , @ProgramFilesDir &  "\Futuresoft\DCSeries\maps",1)
        EndIf
WEnd
Exit

Share this post


Link to post
Share on other sites
Valuater

maybe...

;Program Install (silent mode)
If FileExists(@WorkingDir & "\8003\setup.exe") Then
    $run_file = FileGetShortName(@WorkingDir & "\8003\setup.exe")
    Run ($run_file & " -s")

    ;Copying File Links
    $C1 = @WorkingDir &  "\misc\dynacomm.lnk"
    $C2 = @WorkingDir &  "\misc\session1.ses"
    $C3 = @WorkingDir &  "\misc\standard1.*"

    While 1
        If FileExists (@ProgramFilesDir &  "\Futuresoft\DCSeries\dseries.exe") Then
            FileCopy ($C1 , @DesktopDir,1)
            FileCopy ($C2 , @ProgramFilesDir &  "\Futuresoft\DCSeries\session",9)
            FileCopy ($C3 , @ProgramFilesDir &  "\Futuresoft\DCSeries\maps",9)
            ExitLoop
        EndIf
    Sleep(100)
    WEnd
EndIf
Exit

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
MykeV

Thanks for the help V. 2 questions?

1. What is served by making the entire script an "IF" statement?

2. What purpose does the "FileGetShortName" function serve?

Again. Thanks for your help.

maybe...

;Program Install (silent mode)
If FileExists(@WorkingDir & "\8003\setup.exe") Then
    $run_file = FileGetShortName(@WorkingDir & "\8003\setup.exe")
    Run ($run_file & " -s")

    ;Copying File Links
    $C1 = @WorkingDir &  "\misc\dynacomm.lnk"
    $C2 = @WorkingDir &  "\misc\session1.ses"
    $C3 = @WorkingDir &  "\misc\standard1.*"

    While 1
        If FileExists (@ProgramFilesDir &  "\Futuresoft\DCSeries\dseries.exe") Then
            FileCopy ($C1 , @DesktopDir,1)
            FileCopy ($C2 , @ProgramFilesDir &  "\Futuresoft\DCSeries\session",9)
            FileCopy ($C3 , @ProgramFilesDir &  "\Futuresoft\DCSeries\maps",9)
            ExitLoop
        EndIf
    Sleep(100)
    WEnd
EndIf
Exit

8)

Share this post


Link to post
Share on other sites
SmOke_N

"If" is exactly that, it's conditional, you only want to do something if the condition is true or untrure.

FileGetShortName helps in run commands because spaces in the path sometimes will give you run errors, FileGetShortName() has no 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.

Share this post


Link to post
Share on other sites
Valuater

"If" is exactly that, it's conditional, you only want to do something if the condition is true or untrure.

FileGetShortName helps in run commands because spaces in the path sometimes will give you run errors, FileGetShortName() has no spaces in the path.

exactly,

I didn't know if you were running into errors with this

Run (@WorkingDir & "\8003\setup.exe -s")

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
MykeV

Thanks for the assist fellas. I appreciate it.

Long Live AutoIT!!! :P

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.