• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help for optimization of my script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help for optimization of my script


  • Subject: Re: Help for optimization of my script
  • From: Jean-Christophe Helary <email@hidden>
  • Date: Tue, 19 Jul 2016 22:26:50 +0900

It looks like you could have a script that generates this script based on some values set by the user.

Jean-Christophe 

2016/07/19 22:17、Thomas Labarre <email@hidden> のメール:

Hello list !

I need help to improve my script. It works fine, but it's difficult for others when they need to modify it. I explain:
Within my organisation, we create aliases for shared folders in a particular folder on user's desktop. We manage 300 shared folders and 800 Users! It's a very bad setup, but I can't change the world :)
I have written an applescript to create the aliases. But when some users get access to 30 shared folders, it's boring to implement all the handlers and sub-variables.
So if anybody could help me simplify my work, I would very much appreciate it. And if it could help others, it would be great, too.

My script
##Icones##
set GenericNetworkIcon to "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:GenericNetworkIcon.icns"
set UserIcon to "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:UserIcon.icns"
set InfoIcon to "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:ToolbarInfo.icns"
###########################
########    VARIABLES    ########
###########################
#### A MODIFIER ou COMMENTER #####
############################
---------------------------------------------------
set OSVersion to system attribute "sys2"
###########################
#### Définir UTILISATEUR #####
############################
#set nom_utilisateur to "s_gabelnew" --définir le nom utilisateur (shortname) (A)
set nom_utilisateur to short user name of (system info) -- se base sur le shortname de la session(B)
set MdPUser to "PASSWORD" --(C)
global MdPUser
global nom_utilisateur
##Demande du MdP (Commenter le Handlers dans l'action du script) (D)
on DemandeMDP()
    set demandePwd to display dialog "Entrez le mot de passe de l'utilisateur" & space & nom_utilisateur with title "Mot de Passe Utilisateur" with icon caution default answer "" buttons {"Annuler", "OK"} default button 2 with hidden answer
    set MdPUser to text returned of demandePwd
end DemandeMDP

-----------------------------------------------------------------------------------------------
set PtPartage to "ASH" --DEFINIR LE NOM DU POINT DE PARTAGE
global PtPartage
set PtPartage1 to "Congés CPEA Cernay"
global PtPartage1
set PtPartage2 to "DOSSIER CS"
global PtPartage2
#set PtPartage3 to "Conge CPEA Mulhouse"
#global PtPartage3
set PtPartage4 to "Conges PEA"
global PtPartage4
set PtPartage5 to "PLANNING TRAFIC 9 PLACES"
global PtPartage5
set PtPartage6 to "CS et Autres"
global PtPartage6
set PtPartage7 to "REFERENTS_CARIATIDES"
global PtPartage7
set PtPartage8 to "Etudiants"
global PtPartage8
set PtPartage9 to "FORMATION-CONTINUE"
global PtPartage9
set PtPartage10 to "LABAROCHE"
global PtPartage10
set PtPartage11 to "Materiel pret PT"
global PtPartage11
set PtPartage12 to "Partage PMT"
global PtPartage12
set PtPartage13 to "Plannings CPEA Cernay"
global PtPartage13
set PtPartage14 to "Plannings Mensuels PEA"
global PtPartage14
set PtPartage15 to "Voiture de secteur CPEA Rou"
global PtPartage15
set PtPartage16 to "Dossier Cadre PPEA"
global PtPartage16
set PtPartage17 to "stage"
global PtPartage17
set PtPartage to display dialog "Entrez le nom du point de partage" default answer "" -- Pouvoir taper le nom du pt de partage
#### NE PAS MODIFIER##########
#### Block de création du partage#
###############################
set volumeName to PtPartage
global volumeName
try
    set volumeName1 to PtPartage1
end try
global volumeName1
try
    set volumeName2 to PtPartage2
end try
global volumeName2
try
    set volumeName3 to PtPartage3
end try
global volumeName3
try
    set volumeName4 to PtPartage4
end try
global volumeName4
try
    set volumeName5 to PtPartage5
end try
global volumeName5
try
    set volumeName6 to PtPartage6
end try
global volumeName6
try
    set volumeName7 to PtPartage7
end try
global volumeName7
try
    set volumeName8 to PtPartage8
end try
global volumeName8
try
    set volumeName9 to PtPartage9
end try
global volumeName9
try
    set volumeName10 to PtPartage10
end try
global volumeName10
try
    set volumeName11 to PtPartage11
end try
global volumeName11
try
    set volumeName12 to PtPartage12
end try
global volumeName12
try
    set volumeName13 to PtPartage13
end try
global volumeName13
try
    set volumeName14 to PtPartage14
end try
global volumeName14
try
    set volumeName15 to PtPartage15
end try
global volumeName15
try
    set volumeName16 to PtPartage16
end try
global volumeName16
try
    set volumeName17 to PtPartage17
end try
global volumeName17

set StringVolumeName to "\"" & volumeName & "\""
global StringVolumeName
try
    set StringVolumeName1 to "\"" & volumeName1 & "\""
end try
global StringVolumeName1
try
    set StringVolumeName2 to "\"" & volumeName2 & "\""
end try
global StringVolumeName2
try
    set StringVolumeName3 to "\"" & volumeName3 & "\""
end try
global StringVolumeName3
try
    set StringVolumeName4 to "\"" & volumeName4 & "\""
end try
global StringVolumeName4
try
    set StringVolumeName5 to "\"" & volumeName5 & "\""
end try
global StringVolumeName5
try
    set StringVolumeName6 to "\"" & volumeName6 & "\""
end try
global StringVolumeName6
try
    set StringVolumeName7 to "\"" & volumeName7 & "\""
end try
global StringVolumeName7
try
    set StringVolumeName8 to "\"" & volumeName8 & "\""
end try
global StringVolumeName8
try
    set StringVolumeName9 to "\"" & volumeName9 & "\""
end try
global StringVolumeName9
try
    set StringVolumeName10 to "\"" & volumeName10 & "\""
end try
global StringVolumeName10
try
    set StringVolumeName11 to "\"" & volumeName11 & "\""
end try
global StringVolumeName11
try
    set StringVolumeName12 to "\"" & volumeName12 & "\""
end try
global StringVolumeName12
try
    set StringVolumeName13 to "\"" & volumeName13 & "\""
end try
global StringVolumeName13
try
    set StringVolumeName14 to "\"" & volumeName14 & "\""
end try
global StringVolumeName14
try
    set StringVolumeName15 to "\"" & volumeName15 & "\""
end try
global StringVolumeName15
try
    set StringVolumeName16 to "\"" & volumeName16 & "\""
end try
global StringVolumeName16
try
    set StringVolumeName17 to "\"" & volumeName17 & "\""
end try
global StringVolumeName17


set CheminPartage to "/Volumes/" & StringVolumeName
global CheminPartage
try
    set CheminPartage1 to "/Volumes/" & StringVolumeName1
end try
global CheminPartage1
try
    set CheminPartage2 to "/Volumes/" & StringVolumeName2
end try
global CheminPartage2
try
    set CheminPartage3 to "/Volumes/" & StringVolumeName3
end try
global CheminPartage3
try
    set CheminPartage4 to "/Volumes/" & StringVolumeName4
end try
global CheminPartage4
try
    set CheminPartage5 to "/Volumes/" & StringVolumeName5
end try
global CheminPartage5
try
    set CheminPartage6 to "/Volumes/" & StringVolumeName6
end try
global CheminPartage6
try
    set CheminPartage7 to "/Volumes/" & StringVolumeName7
end try
global CheminPartage7
try
    set CheminPartage8 to "/Volumes/" & StringVolumeName8
end try
global CheminPartage8
try
    set CheminPartage9 to "/Volumes/" & StringVolumeName9
end try
global CheminPartage9
try
    set CheminPartage10 to "/Volumes/" & StringVolumeName10
end try
global CheminPartage10
try
    set CheminPartage11 to "/Volumes/" & StringVolumeName11
end try
global CheminPartage11
try
    set CheminPartage12 to "/Volumes/" & StringVolumeName12
end try
global CheminPartage12
try
    set CheminPartage13 to "/Volumes/" & StringVolumeName13
end try
global CheminPartage13
try
    set CheminPartage14 to "/Volumes/" & StringVolumeName14
end try
global CheminPartage14
try
    set CheminPartage15 to "/Volumes/" & StringVolumeName15
end try
global CheminPartage15
try
    set CheminPartage16 to "/Volumes/" & StringVolumeName16
end try
global CheminPartage16
try
    set CheminPartage17 to "/Volumes/" & StringVolumeName17
end try
global CheminPartage17

set FolderPath to do shell script ("FOLDERPATH=" & CheminPartage & ";echo $FOLDERPATH")
global FolderPath
try
    set FolderPath1 to do shell script ("FOLDERPATH=" & CheminPartage1 & ";echo $FOLDERPATH")
end try
global FolderPath1
try
    set FolderPath2 to do shell script ("FOLDERPATH=" & CheminPartage2 & ";echo $FOLDERPATH")
end try
global FolderPath2
try
    set FolderPath3 to do shell script ("FOLDERPATH=" & CheminPartage3 & ";echo $FOLDERPATH")
end try
global FolderPath3
try
    set FolderPath4 to do shell script ("FOLDERPATH=" & CheminPartage4 & ";echo $FOLDERPATH")
end try
global FolderPath4
try
    set FolderPath5 to do shell script ("FOLDERPATH=" & CheminPartage5 & ";echo $FOLDERPATH")
end try
global FolderPath5
try
    set FolderPath6 to do shell script ("FOLDERPATH=" & CheminPartage6 & ";echo $FOLDERPATH")
end try
global FolderPath6
try
    set FolderPath7 to do shell script ("FOLDERPATH=" & CheminPartage7 & ";echo $FOLDERPATH")
end try
global FolderPath7
try
    set FolderPath8 to do shell script ("FOLDERPATH=" & CheminPartage8 & ";echo $FOLDERPATH")
end try
global FolderPath8
try
    set FolderPath9 to do shell script ("FOLDERPATH=" & CheminPartage9 & ";echo $FOLDERPATH")
end try
global FolderPath9
try
    set FolderPath10 to do shell script ("FOLDERPATH=" & CheminPartage10 & ";echo $FOLDERPATH")
end try
global FolderPath10
try
    set FolderPath11 to do shell script ("FOLDERPATH=" & CheminPartage11 & ";echo $FOLDERPATH")
end try
global FolderPath11
try
    set FolderPath12 to do shell script ("FOLDERPATH=" & CheminPartage12 & ";echo $FOLDERPATH")
end try
global FolderPath12
try
    set FolderPath13 to do shell script ("FOLDERPATH=" & CheminPartage13 & ";echo $FOLDERPATH")
end try
global FolderPath13
try
    set FolderPath14 to do shell script ("FOLDERPATH=" & CheminPartage14 & ";echo $FOLDERPATH")
end try
global FolderPath14
try
    set FolderPath15 to do shell script ("FOLDERPATH=" & CheminPartage15 & ";echo $FOLDERPATH")
end try
global FolderPath15
try
    set FolderPath16 to do shell script ("FOLDERPATH=" & CheminPartage16 & ";echo $FOLDERPATH")
end try
global FolderPath16
try
    set FolderPath17 to do shell script ("FOLDERPATH=" & CheminPartage17 & ";echo $FOLDERPATH")
end try
global FolderPath17

set StringFolderPath to "\"" & FolderPath & "\""
global StringFolderPath
try
    set StringFolderPath1 to "\"" & FolderPath1 & "\""
end try
global StringFolderPath2
try
    set StringFolderPath2 to "\"" & FolderPath2 & "\""
end try
global StringFolderPath3
try
    set StringFolderPath3 to "\"" & FolderPath3 & "\""
end try
global StringFolderPath3
try
    set StringFolderPath4 to "\"" & FolderPath4 & "\""
end try
global StringFolderPath4
try
    set StringFolderPath5 to "\"" & FolderPath5 & "\""
end try
global StringFolderPath5
try
    set StringFolderPath6 to "\"" & FolderPath6 & "\""
end try
global StringFolderPath6
try
    set StringFolderPath7 to "\"" & FolderPath7 & "\""
end try
global StringFolderPath7
try
    set StringFolderPath8 to "\"" & FolderPath8 & "\""
end try
global StringFolderPath8
try
    set StringFolderPath9 to "\"" & FolderPath9 & "\""
end try
global StringFolderPath9
try
    set StringFolderPath10 to "\"" & FolderPath10 & "\""
end try
global StringFolderPath10
try
    set StringFolderPath11 to "\"" & FolderPath11 & "\""
end try
global StringFolderPath11
try
    set StringFolderPath12 to "\"" & FolderPath12 & "\""
end try
global StringFolderPath12
try
    set StringFolderPath13 to "\"" & FolderPath13 & "\""
end try
global StringFolderPath13
try
    set StringFolderPath14 to "\"" & FolderPath14 & "\""
end try
global StringFolderPath14
try
    set StringFolderPath15 to "\"" & FolderPath15 & "\""
end try
global StringFolderPath15
try
    set StringFolderPath16 to "\"" & FolderPath16 & "\""
end try
global StringFolderPath16
try
    set StringFolderPath17 to "\"" & FolderPath17 & "\""
end try
global StringFolderPath17

set UserDesktop to POSIX path of (path to desktop folder from user domain)
global UserDesktop
set DossierConnexion to POSIX path of UserDesktop & "CONNEXIONS"
global DossierConnexion
set mauvais_connexion to POSIX path of UserDesktop & "CONEXION"
global mauvais_connexion
set mauvais_connexion0 to POSIX path of UserDesktop & "CONEXIONS"
global mauvais_connexion0
set mauvais_connexion1 to POSIX path of UserDesktop & "CONNEXION"
global mauvais_connexion1

set LePointDePartage to FolderPath
global LePointDePartage
try
    set LePointDePartage1 to FolderPath1
end try
global LePointDePartage1
try
    set LePointDePartage2 to FolderPath2
end try
global LePointDePartage2
try
    set LePointDePartage3 to FolderPath3
end try
global LePointDePartage3
try
    set LePointDePartage4 to FolderPath4
end try
global LePointDePartage4
try
    set LePointDePartage5 to FolderPath5
end try
global LePointDePartage5
try
    set LePointDePartage6 to FolderPath6
end try
global LePointDePartage6
try
    set LePointDePartage7 to FolderPath7
end try
global LePointDePartage7
try
    set LePointDePartage8 to FolderPath8
end try
global LePointDePartage8
try
    set LePointDePartage9 to FolderPath9
end try
global LePointDePartage9
try
    set LePointDePartage10 to FolderPath10
end try
global LePointDePartage10
try
    set LePointDePartage11 to FolderPath11
end try
global LePointDePartage11
try
    set LePointDePartage12 to FolderPath12
end try
global LePointDePartage12
try
    set LePointDePartage13 to FolderPath13
end try
global LePointDePartage13
try
    set LePointDePartage14 to FolderPath14
end try
global LePointDePartage14
try
    set LePointDePartage15 to FolderPath15
end try
global LePointDePartage15
try
    set LePointDePartage16 to FolderPath16
end try
global LePointDePartage16
try
    set LePointDePartage17 to FolderPath17
end try
global LePointDePartage17

set DossierPartager to POSIX file LePointDePartage
global DossierPartager
try
    set DossierPartager1 to POSIX file LePointDePartage1
end try
global DossierPartager1
try
    set DossierPartager2 to POSIX file LePointDePartage2
end try
global DossierPartager2
try
    set DossierPartager3 to POSIX file LePointDePartage3
end try
global DossierPartager3
try
    set DossierPartager4 to POSIX file LePointDePartage4
end try
global DossierPartager4
try
    set DossierPartager5 to POSIX file LePointDePartage5
end try
global DossierPartager5
try
    set DossierPartager6 to POSIX file LePointDePartage6
end try
global DossierPartager6
try
    set DossierPartager7 to POSIX file LePointDePartage7
end try
global DossierPartager7
try
    set DossierPartager8 to POSIX file LePointDePartage8
end try
global DossierPartager8
try
    set DossierPartager9 to POSIX file LePointDePartage9
end try
global DossierPartager9
try
    set DossierPartager10 to POSIX file LePointDePartage10
end try
global DossierPartager10
try
    set DossierPartager11 to POSIX file LePointDePartage11
end try
global DossierPartager11
try
    set DossierPartager12 to POSIX file LePointDePartage12
end try
global DossierPartager12
try
    set DossierPartager13 to POSIX file LePointDePartage13
end try
global DossierPartager13
try
    set DossierPartager14 to POSIX file LePointDePartage14
end try
global DossierPartager14
try
    set DossierPartager15 to POSIX file LePointDePartage15
end try
global DossierPartager15
try
    set DossierPartager16 to POSIX file LePointDePartage16
end try
global DossierPartager16
try
    set DossierPartager17 to POSIX file LePointDePartage17
end try
global DossierPartager17

set CheminAlias to DossierConnexion
global CheminAlias
set TheAlias to POSIX file CheminAlias
global TheAlias
#######################
#######OPTIONNEL####### --Dans le cas de renommer le nom de l'alias
#######################
#set NomPtPartage to "NOUVEAU NOM ALIAS" as string --Définir le nom personnalisé de l'alias

####################################################
###Définir le serveur### --Commenter la ligne inutile
####################################################
set XservePartages to "informat-xserve-partages.ch-rouffach.fr"
#set RackStation to "rackstation27.ch-rouffach.fr"
try
    set serveur to XservePartages
end try
try
    set serveur to RackStation
end try

global serveur
####Handlers montage du volume réseau####
on MontageVolumes()
    
    mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName
    
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName1
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName2
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName3
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName4
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName5
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName6
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName7
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName8
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName9
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName10
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName11
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName12
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName13
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName14
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName15
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName16
    end try
    try
        mount volume "afp://" & nom_utilisateur & ":" & MdPUser & "@" & serveur & "/" & volumeName17
    end try
end MontageVolumes
#### Information sur les connexions paramétrées
if OSVersion as string = "5" or OSVersion as string = "6" then
    display dialog "Les connesions suivantes seront installées dans votre dossier Connexions : " & PtPartage default button 1 giving up after 3 buttons {"Super !! Merci"} with icon 1 ---& space & PtPartage1 & space & PtPartage2 & space & PtPartage3 ########################
else
    display dialog "Les connesions suivantes seront installées dans votre dossier Connexions : " & PtPartage default button 1 giving up after 3 buttons {"Super !! Merci"} with icon file {InfoIcon} ---& space & PtPartage1 & space & PtPartage2 & space & PtPartage3 ########################
end if
####Handlers####
##Création Dossier Connexion
on CreationDossierConnexion()
    tell application "Finder"
        if not (the folder "Connexions" of desktop exists) then
            make new folder at desktop with properties {name:"Connexions"}
        end if
    end tell
end CreationDossierConnexion
## Suppression ancien alias
on SuppressionAncienAlias()
    try
        do shell script "rm" & space & DossierConnexion & "/" & space & StringVolumeName
    end try
end SuppressionAncienAlias
## Suppression ancien alias1
on SuppressionAncienAlias1()
    try
        do shell script "rm" & space & DossierConnexion & "/" & space & StringVolumeName1
    end try
end SuppressionAncienAlias1
## Suppression ancien alias2
on SuppressionAncienAlias2()
    try
        do shell script "rm" & space & DossierConnexion & "/" & space & StringVolumeName2
    end try
end SuppressionAncienAlias2
## Suppression ancien alias3
on SuppressionAncienAlias3()
    try
        do shell script "rm" & space & DossierConnexion & "/" & space & StringVolumeName3
    end try
end SuppressionAncienAlias3
on SuppressionAncienAlias4()
    try
        do shell script "rm" & space & DossierConnexion & "/" & space & StringVolumeName4
    end try
end SuppressionAncienAlias4
on SuppressionAncienAlias5()
    try
        do shell script "rm" & space & DossierConnexion & "/" & space & StringVolumeName5
    end try
end SuppressionAncienAlias5
on SuppressionAncienAlias6()
    try
        do shell script "rm" & space & DossierConnexion & "/" & space & StringVolumeName6
    end try
end SuppressionAncienAlias6
on SuppressionAncienAlias7()
    try
        do shell script "rm" & space & DossierConnexion & "/" & space & StringVolumeName7
    end try
end SuppressionAncienAlias7
## Suppression ancien alias mauvais dossier connexion (CONEXION)
on MauvaisDossierConnexion()
    try
        do shell script "rm" & space & mauvais_connexion & "/" & space & StringVolumeName --Suppression de l'ancien alias
    end try
end MauvaisDossierConnexion
on MauvaisDossierConnexionVN1()
    try
        do shell script "rm" & space & mauvais_connexion & "/" & space & StringVolumeName1
    end try
end MauvaisDossierConnexionVN1
on MauvaisDossierConnexionVN2()
    try
        do shell script "rm" & space & mauvais_connexion & "/" & space & StringVolumeName2
    end try
end MauvaisDossierConnexionVN2
on MauvaisDossierConnexionVN3()
    try
        do shell script "rm" & space & mauvais_connexion & "/" & space & StringVolumeName3
    end try
end MauvaisDossierConnexionVN3
on MauvaisDossierConnexionVN4()
    try
        do shell script "rm" & space & mauvais_connexion & "/" & space & StringVolumeName4
    end try
end MauvaisDossierConnexionVN4
on MauvaisDossierConnexionVN5()
    try
        do shell script "rm" & space & mauvais_connexion & "/" & space & StringVolumeName5
    end try
end MauvaisDossierConnexionVN5
on MauvaisDossierConnexionVN6()
    try
        do shell script "rm" & space & mauvais_connexion & "/" & space & StringVolumeName6
    end try
end MauvaisDossierConnexionVN6
on MauvaisDossierConnexionVN7()
    try
        do shell script "rm" & space & mauvais_connexion & "/" & space & StringVolumeName7
    end try
end MauvaisDossierConnexionVN7
## Suppression ancien alias mauvais dossier connexion (CONEXIONS)
on MauvaisDossierConnexion0()
    try
        do shell script "rm" & space & mauvais_connexion0 & "/" & space & StringVolumeName --Suppression de l'ancien alias
    end try
end MauvaisDossierConnexion0
on MauvaisDossierConnexion0VN1()
    try
        do shell script "rm" & space & mauvais_connexion0 & "/" & space & StringVolumeName1
    end try
end MauvaisDossierConnexion0VN1
on MauvaisDossierConnexion0VN2()
    try
        do shell script "rm" & space & mauvais_connexion0 & "/" & space & StringVolumeName2
    end try
end MauvaisDossierConnexion0VN2
on MauvaisDossierConnexion0VN3()
    try
        do shell script "rm" & space & mauvais_connexion0 & "/" & space & StringVolumeName3
    end try
end MauvaisDossierConnexion0VN3
on MauvaisDossierConnexion0VN4()
    try
        do shell script "rm" & space & mauvais_connexion0 & "/" & space & StringVolumeName4
    end try
end MauvaisDossierConnexion0VN4
on MauvaisDossierConnexion0VN5()
    try
        do shell script "rm" & space & mauvais_connexion0 & "/" & space & StringVolumeName5
    end try
end MauvaisDossierConnexion0VN5
on MauvaisDossierConnexion0VN6()
    try
        do shell script "rm" & space & mauvais_connexion0 & "/" & space & StringVolumeName6
    end try
end MauvaisDossierConnexion0VN6
on MauvaisDossierConnexion0VN7()
    try
        do shell script "rm" & space & mauvais_connexion0 & "/" & space & StringVolumeName7
    end try
end MauvaisDossierConnexion0VN7
## Suppression ancien alias mauvais dossier connexion (CONNEXION)
on MauvaisDossierConnexion1()
    try
        do shell script "rm" & space & mauvais_connexion1 & "/" & space & StringVolumeName --Suppression de l'ancien alias
    end try
end MauvaisDossierConnexion1
on MauvaisDossierConnexion1VN1()
    try
        do shell script "rm" & space & mauvais_connexion1 & "/" & space & StringVolumeName1
    end try
end MauvaisDossierConnexion1VN1
on MauvaisDossierConnexion1VN2()
    try
        do shell script "rm" & space & mauvais_connexion1 & "/" & space & StringVolumeName2
    end try
end MauvaisDossierConnexion1VN2
on MauvaisDossierConnexion1VN3()
    try
        do shell script "rm" & space & mauvais_connexion1 & "/" & space & StringVolumeName3
    end try
end MauvaisDossierConnexion1VN3
on MauvaisDossierConnexion1VN4()
    try
        do shell script "rm" & space & mauvais_connexion1 & "/" & space & StringVolumeName4
    end try
end MauvaisDossierConnexion1VN4
on MauvaisDossierConnexion1VN5()
    try
        do shell script "rm" & space & mauvais_connexion1 & "/" & space & StringVolumeName5
    end try
end MauvaisDossierConnexion1VN5
on MauvaisDossierConnexion1VN6()
    try
        do shell script "rm" & space & mauvais_connexion1 & "/" & space & StringVolumeName6
    end try
end MauvaisDossierConnexion1VN6
on MauvaisDossierConnexion1VN7()
    try
        do shell script "rm" & space & mauvais_connexion1 & "/" & space & StringVolumeName7
    end try
end MauvaisDossierConnexion1VN7
##Déplacement des élément d'un dossier connexions mal orthographié
on DeplacementFichiersMauvaisConnexion()
    try
        do shell script "mv " & mauvais_connexion & "/* " & DossierConnexion
    end try
end DeplacementFichiersMauvaisConnexion
on DeplacementFichiersMauvaisConnexion0()
    try
        do shell script "mv " & mauvais_connexion0 & "/* " & DossierConnexion
    end try
end DeplacementFichiersMauvaisConnexion0
on DeplacementFichiersMauvaisConnexion1()
    try
        do shell script "mv " & mauvais_connexion1 & "/* " & DossierConnexion
    end try
end DeplacementFichiersMauvaisConnexion1

##Suppression dossiers connexions mal orthographiés
on SuppressionMauvaisConnexion()
    try
        do shell script "rm -R " & mauvais_connexion
    end try
end SuppressionMauvaisConnexion
on SuppressionMauvaisConnexion0()
    try
        do shell script "rm -R " & mauvais_connexion0
    end try
end SuppressionMauvaisConnexion0
on SuppressionMauvaisConnexion1()
    try
        do shell script "rm -R " & mauvais_connexion1
    end try
end SuppressionMauvaisConnexion1

#############################################################################################
###############
##     Les actions     ##
###############
### Environement utilisateur (décommenter si (A) est défini)
#DemandeMDP()
#Creation du dossier Connexion si inexistant
CreationDossierConnexion()
### Suppression de l'ancien lien de partage ; déplacement du contenu du dossier connexions ; suppression du mauvais dossier de connexion
SuppressionAncienAlias()

SuppressionAncienAlias1()

SuppressionAncienAlias2()

SuppressionAncienAlias3()
SuppressionAncienAlias4()
SuppressionAncienAlias5()
SuppressionAncienAlias6()
SuppressionAncienAlias7()
###

MauvaisDossierConnexion()
try
    MauvaisDossierConnexionVN1()
end try
try
    MauvaisDossierConnexionVN2()
end try
try
    MauvaisDossierConnexionVN3()
end try
try
    MauvaisDossierConnexionVN4()
end try
try
    MauvaisDossierConnexionVN5()
end try
try
    MauvaisDossierConnexionVN6()
end try
try
    MauvaisDossierConnexionVN7()
end try
try
    MauvaisDossierConnexion0()
end try
try
    MauvaisDossierConnexion0VN1()
end try
try
    MauvaisDossierConnexion0VN2()
end try
try
    MauvaisDossierConnexion0VN3()
end try
try
    MauvaisDossierConnexion0VN4()
end try
try
    MauvaisDossierConnexion0VN5()
end try
try
    MauvaisDossierConnexion0VN6()
end try
try
    MauvaisDossierConnexion0VN7()
end try
try
    MauvaisDossierConnexion1()
end try
try
    MauvaisDossierConnexion1VN1()
end try
try
    MauvaisDossierConnexion1VN2()
end try
try
    MauvaisDossierConnexion1VN3()
end try
try
    MauvaisDossierConnexion1VN4()
end try
try
    MauvaisDossierConnexion1VN5()
end try
try
    MauvaisDossierConnexion1VN6()
end try
try
    MauvaisDossierConnexion1VN7()
end try

DeplacementFichiersMauvaisConnexion()
try
    DeplacementFichiersMauvaisConnexion0()
end try
try
    DeplacementFichiersMauvaisConnexion1()
end try

SuppressionMauvaisConnexion()
try
    SuppressionMauvaisConnexion0()
end try
try
    SuppressionMauvaisConnexion1()
end try
####################################
#####Montage des Volumes#####
####################################
MontageVolumes()
####################################
#####Creation Alias dans le Dossier Connexions#####
####################################
tell application "Finder" to make alias to folder DossierPartager at TheAlias

try
    tell application "Finder" to make alias to folder DossierPartager1 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager2 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager3 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager4 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager5 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager6 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager7 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager8 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager9 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager10 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager11 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager12 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager13 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager14 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager15 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager16 at TheAlias
end try
try
    tell application "Finder" to make alias to folder DossierPartager17 at TheAlias
end try
delay 5

##############
##OPTIONNEL##### -- Décommenter si besoin
##################################
### RENOMMER L'ALIAS DE CONNEXION######
##################################
#set volumeNameRename to NomPtPartage
#set StringVolumeNameRename to "\"" & volumeNameRename & "\""
#set CheminPartageRename to StringVolumeNameRename
#set PathRename to do shell script ("FOLDERPATHRENAME=" & CheminPartageRename & ";echo $FOLDERPATHRENAME")
#set UserDesktop to POSIX path of (path to desktop folder from user domain)
#set DossierConnexionRename to POSIX path of UserDesktop & "CONNEXIONS/" & CheminPartageRename as Unicode text
#set PointDePartageRename to PathRename
#set DossierPartager to POSIX file PointDePartageRename
#set CheminAliasRename to DossierConnexionRename
#set TheAliasRename to POSIX file DossierConnexionRename as string
#do shell script "mv " & DossierConnexion & "/" & PtPartage & " " & DossierConnexionRename
if OSVersion as string = "5" or OSVersion as string = "6" then
    display dialog "Le partage" & space & volumeName & space & "se trouve maintenance dans votre dossier Connexions" buttons {"OK"} default button 1 with icon 1
    #display dialog "Les partages" & space & volumeName & space & volumeName1 & space & volumeName2 & space & volumeName3 & space & "se trouvent maintenant dans votre dossier Connexions" buttons {"OK"} default button 1 with icon 2
else
    display dialog "Le partage" & space & volumeName & space & "se trouve maintenance dans votre dossier Connexions" buttons {"OK"} default button 1 with icon file {GenericNetworkIcon}
    #display dialog "Les partages" & space & volumeName & space & volumeName1 & space & volumeName2 & space & volumeName3 & space & "se trouvent maintenant dans votre dossier Connexions" buttons {"OK"} default button 1 with icon file {GenericNetworkIcon}
end if

#################
#####     FIN     #####
#################



--
Cordialement,

Thomas LABARRE
Technicien Support
GIP Symaris
Pôle Infogérance
27 rue du 4ème RSM B.P. 29
F-68250 ROUFFACH
Tél CSU : 03 68 09 25 20
Web : http://www.symaris.com
Courriel : email@hidden

Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users This email sent to email@hidden
  • Follow-Ups:
    • Re: Help for optimization of my script
      • From: Thomas Labarre <email@hidden>
References: 
 >Help for optimization of my script (From: Thomas Labarre <email@hidden>)

  • Prev by Date: Help for optimization of my script
  • Next by Date: Re: need explanation for trivial Safari script behavior
  • Previous by thread: Help for optimization of my script
  • Next by thread: Re: Help for optimization of my script
  • Index(es):
    • Date
    • Thread