Moving already existing files&Create shortcut with parameter

Got a problem you cannot solve? Try here.
Post Reply
Feyh
Posts: 21
Joined: Thu Apr 05, 2012 2:48 am

Moving already existing files&Create shortcut with parameter

Post by Feyh »

Hello there,

Maybe someone can help me handling the following:

Process:
1. My installation starts
2. When it comes to the dialoge where the user can change the directory the following should happen:
- My installation should check this path. And if there is already an older installation of my programm a message should pop up with something like:
"Hey you! There's already an older installation. The never version needs your config-file on another location. Do you want me to move it?"
YES: I want to move some files out of his older installation directory into a new directory in \AllUsers\. After that my installation should continue as usual and copy the new files into the installation directory.
NO: All new files, except the config, should be installed into the installation directory. Now i have to create a shortcut to the .exe file and add some starting parameters to it (path to the config-file).


Someone got some tips how to do this? I don't want you to give me a solution for the whole thing (would be cool, but i want to learn something instead of just copy some text :wink: )
- Are there any functions to create a shortcut or add starting parameters to a shortcut?
- How is the function called with that i'm able to move already existing files into an other directory?

I will return next monday, so don't wonder when i'm not answering.

Thanks in advance!

Greetings
Feyh
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Moving already existing files&Create shortcut with param

Post by FrancescoT »

Dear Feyh,

there is a thing that is not enough clear to me.

If you run an install over a previous one already installed, before the directory selection it is showed, your previous install is removed.
So my consideration is; your files will be not available anymore on target system.

Because above, you should check for the presence of this file during "Check Application Pre-Requisites".
Doing this you could copy your file to any other location using "Copy / Move Local Files" command.
The command is a Windows Installer command, so to execute it immediately, you must use it with NATIVE ENGINE mode.

Code: Select all

Set Variable NATIVE_ENGINE to TRUE
Copy Local Files \ to 
Set Variable NATIVE_ENGINE to FALSE
Regarding Shortcut creation question, probably I have missed something, "Create Shortcut" command already does it.
I'm wrong?

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Feyh
Posts: 21
Joined: Thu Apr 05, 2012 2:48 am

Re: Moving already existing files&Create shortcut with param

Post by Feyh »

Good Morning FrancescoT,

thanks a lot for your help!

The older installation won't be removed because it was created with another installer. We are new to installaware.
So for the first time the customer will install our software with the InstallAware installer i have to check if he had the older version of this software.If yes, i need to move his files, if not, everything is fine and I can continue as usual.

As i mentioned above I'm new to InstallAware and so i don't know all the commands =). Thanks for the advice, i will have a look at "Move Local Files", seems that this is what i searched for.
The "Create Shortcut" command also sounds like that i was looking for.

Thanks for your help!
I'll try this out and in case of more questions i'll post it here.

Greetings
Feyh
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Moving already existing files&Create shortcut with param

Post by FrancescoT »

Dear Feyh,

I can also suggest to you to have a look at the following topic.
http://www.installaware.com/forum/viewt ... f=3&t=1237

It is about a plugin that could help you to unistall some packages not created with InstallAware.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Feyh
Posts: 21
Joined: Thu Apr 05, 2012 2:48 am

Re: Moving already existing files&Create shortcut with param

Post by Feyh »

Hey FrancescoT,

thanks for the link, i will have a look on it.

Another (obviously stupid) question:

How can I check a path for files?

Example: I want to check if there is a "Example.jpg" in "C://Programs/Calculator/".
How can i do this?

Greetings
Feyh

Edit:

Ok, i found a function named "Does File/Folder exists". I guess thats what i was looking for.
I should have a closer look on the commands before posting here :roll:
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Moving already existing files&Create shortcut with param

Post by FrancescoT »

Dear Feyh,

You are right, "Does File/Folder exists" exactly does what you are looking for.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Feyh
Posts: 21
Joined: Thu Apr 05, 2012 2:48 am

Re: Moving already existing files&Create shortcut with param

Post by Feyh »

Hey,

everything mentioned in the posts before is working fine!

New questions:
First one:
Is it possible to do a "if expression 1 OR expression2" ?

Seccond one:
Example:
$ROOTDIR$ = C:\\Documents\User\Installs\MyProgram\executables

Path for tools = C:\\Documents\User\Installs\Tools

Now i want to use "Does File exist" to check if there is a specific tool in the directory "\Installs\Tools\".
I want to move out of the $ROOTDIR$ backwards to the tools directory.
I guess i can do that with "Run Program cmd.exe" and command line parameter cd.

Right now i'm using:

Code: Select all

Run Program cmd.exe /cd .., startup in folder $ROOTDIR$

Code: Select all

~InstallAware Clipboard Data~
~Run Program As~
~{ED7CB8B9-DB01-41FE-A4A2-7071F4BE4205}~
~cmd.exe~
~$ROOTDIR$~
~/cd ..~
~0~
~~
~~
~~
~TEST~
~FALSE~
~~
How can i get the new path into a variable? (After i used 2 times /cd .. on $ROOTDIR$ it should be C:\\Documents\User\Installs\ )


Greetings
Feyh


Edit:

Found a solution using Parse string.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Moving already existing files&Create shortcut with param

Post by FrancescoT »

Dear Feyh,
First one:
Is it possible to do a "if expression 1 OR expression2" ?
No, it is not possible. You can only use "if expression".

Regarding you second question, you can't use Run command in that way instead you can do:

Code: Select all

Set Variable MYPATH to C:\Documents\User\Installs\MyProgram\executables
Parse String $MYPATH$ into Variables MYPATH and  (Split at last occurrence of pattern)
Parse String $MYPATH$ into Variables MYPATH and  (Split at last occurrence of pattern)

Code: Select all

~InstallAware Clipboard Data~
~Parse String~
~{358DC229-80DB-4426-8856-B165E24D3849}~
~$MYPATH$~
~\~
~MYPATH~
~~
~1~
~FALSE~
~FALSE~
~Parse String~
~{CCA7F509-D586-40B5-8595-8A886C993550}~
~$MYPATH$~
~\~
~MYPATH~
~~
~1~
~FALSE~
~FALSE~
~Set Variable~
~{F0282943-9D30-4690-B23C-2BD081415637}~
~MYPATH$MYAH$MYAH$FALSE~
~C:\Documents\User\Installs\MyProgram\executables~
This should works!

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Feyh
Posts: 21
Joined: Thu Apr 05, 2012 2:48 am

Re: Moving already existing files&Create shortcut with param

Post by Feyh »

Hey FrancescoT,

my project is almost finished and everything is working fine.

Thanks a lot for your help!

Greetings
Feyh
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Moving already existing files&Create shortcut with param

Post by FrancescoT »

:D :D :D :D
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply