How to create a shorcut during installation process

Hello,
I’m newbie in the mac world and newbiex2 in the applescript world…
I’m developing a game on PC and mac with flash. This game will be installed for mac user thanks to Iceberg, a software which allow you to create package.
With this software you can add applescript to run during or after the installation process.
I need to find (or create) a script for creating a shortcut of the game (placed in Applications) on the desktop of the user.
It’s probably something very commun 8)
Thanks a lot.
Regards,
Zoarx.

Hi,

Here’s making the alias file part:

set apps_path to (path to At Ease applications folder from local domain) as string
set game_ref to (apps_path & “GameName.rtf”) as alias
tell application “Finder”
make new alias file to game_ref at desktop
end tell

It’s easy to ask the users if they want an alias there also. And I just used “GameName.rtf” as a test file.

Editted: and you might want to test it out on the package and maybe add an error check to see if the app is there in the Applications folder.

gl,

thanks a lot for your answer.
Here is the code created in the script editor which is OK:

set apps_path to (“:Applications:Lucette a disparu:”) as string
set game_ref to (apps_path & “LaLuciole.app”) as alias

tell application “Finder”
make new alias file to game_ref at desktop
end tell

When I run it, the shortcut is created.
But if I place it in script postflight to run in Iceberg (hope you know this software), it doens’t.
Any idea?it’s a path problem?
thanks a lot.

Hi zorax,

I got it to work by saving the script as application. Make sure the “Never show startup screen” is checked otherwise a window will open asking you if you want to run the script.

Iceberg probably doesn’t know how to run Compiled Scripts.

BTW, great app.

gl,

thanks kel!

when you said :

“It’s easy to ask the users if they want an alias there also. And I just used “GameName.rtf” as a test file.”

Do you add sthg in the script to check if the application exists, and if yes display the question?
How do you display sthg in the process installation?

"Editted: and you might want to test it out on the package and maybe add an error check to see if the app is there in the Applications folder. "

Do you have the script for that?

Regards,
Zorax

Hi,

Something like this:

activate
display dialog “Place a shortcut on the desktop?”
set apps_path to (path to At Ease applications folder from local domain) as string
try
set game_ref to (apps_path & “MyGame.app”) as alias
on error – app is not in Applications folder
set game_ref to (choose file with prompt “Where is MyGame.app?”)
if game_ref is false then return
end try
tell application “Finder”
make alias to game_ref at desktop
end tell

It first asks the user if user wants the alias file. If the user cancels then no alias file, otherwise it tries to looke for the game by getting a reference. If it can’t make the reference then it errors and asks the user to locate the game. The user can still can still cancel (I haven’t tested this because the installer always installs the game at the right place) or continue making the alias file.

I haven’t used the Iceberg much, but there must be something in there that allows the user to choose where to install. That’s the case where you would want to check where the game was installed.

gl,

It’s perfect!
you’re a genius!
Best Regards,
Zorax

Hi,

Glad it works for you.

One thing, this line can be deleted:

if game_ref is false then return

I got it mixed up with the ‘choose from list’ command.

gl,