gh0stid Posted August 17, 2012 Posted August 17, 2012 Hello, sorry to bother you all people but i have a question .. im having a hard time fixing it... the whole script is working except if i try to use runas .. instead it work perfectly from start to end. or at least it seem to .. sorry for my bad english the problem is the following, when i start the compiled program, the installation goes without problem BUT at the end, it seem to break . the last part where filewrite is doesnt seem to be working ( i assume its cause of runas not continuing after the first execution of the .exe) I need help asap please.. please take in consideration that im a complete noob and willing to learn. thank you for your future help expandcollapse popup#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator ;validation si installation déja présente If FileExists ("C:\Program Files\SAGEFormation\sageformation.wdd") Then fin() Else install() EndIf Func install() ; Demarrer L'installation SageFormation RunAs ("user", "domain", "password", 0, "\\sc15\app\SageInstallationReseau\Install.Exe", "") ;WinSetState("SAGEFormation - Assistant d'installation", "", @SW_HIDE) ;WinSetState("[CLASS:WinDevObject]", "", @SW_HIDE) ;On bloque le clavier et souris ;BlockInput(1) ; Premiere fenetre WinWaitActive("SAGEFormation - Assistant d'installation") ;WinSetState("SAGEFormation - Assistant d'installation", "", @SW_HIDE) ; on cache la fenêtre d'install Send("C:\Program Files\SageFormation") Send("{ENTER}") ;Deuxieme fenetre sleep (25000) WinWaitActive("SAGEFormation - Assistant d'installation") ;WinSetState("SAGEFormation - Assistant d'installation", "", @SW_HIDE) ; on cache la fenêtre d'install Send("{TAB}") Send("{SPACE}") ;Lancer le programme Send("{TAB}") Send("{SPACE}") ;Placer une icone sur le bureau ( pour tous les utilisateurs ) Send("{TAB}") Send("{SPACE}") ;Placer une icone dans le menu demarrer ( pour tous les utilsateurs ) Send("{TAB}") Send("{SPACE}") ;Placer une icone dans la barre de lancement rapide ( pour tous les utilisateurs ) Send("{TAB}") Send("{ENTER}") ;WinSetState("SAGEFormation - Assistant d'installation", "", @SW_SHOW) sleep (5000) ;population du fichier sage.ini avant ouverture primaire Local $file = FileOpen("C:\Program Files\SAGEFormation\sage.ini",2) FileWrite($file, "[SAGEFORMATION]" & @CRLF) FileWrite($file, "CheminBD=H:\SageData" & @CRLF) FileWrite($file, "VersionWindex=OUI") FileClose($file) sleep (5000) ;BlockInput(0) EndFunc ;FIN DU SCRIPT func fin() Exit EndFunc ;ouverture de l'application Run ("C:\Program Files\SageFormation\SAGEFormation.exe")
abberration Posted August 17, 2012 Posted August 17, 2012 You really should be using IniWrite instead. Try it this way: expandcollapse popup#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator ;validation si installation déja présente If FileExists ("C:Program FilesSAGEFormationsageformation.wdd") Then fin() Else install() EndIf Func install() ; Demarrer L'installation SageFormation RunAs ("user", "domain", "password", 0, "sc15appSageInstallationReseauInstall.Exe", "") ;WinSetState("SAGEFormation - Assistant d'installation", "", @SW_HIDE) ;WinSetState("[CLASS:WinDevObject]", "", @SW_HIDE) ;On bloque le clavier et souris ;BlockInput(1) ; Premiere fenetre WinWaitActive("SAGEFormation - Assistant d'installation") ;WinSetState("SAGEFormation - Assistant d'installation", "", @SW_HIDE) ; on cache la fenêtre d'install Send("C:Program FilesSageFormation") Send("{ENTER}") ;Deuxieme fenetre sleep (25000) WinWaitActive("SAGEFormation - Assistant d'installation") ;WinSetState("SAGEFormation - Assistant d'installation", "", @SW_HIDE) ; on cache la fenêtre d'install Send("{TAB}") Send("{SPACE}") ;Lancer le programme Send("{TAB}") Send("{SPACE}") ;Placer une icone sur le bureau ( pour tous les utilisateurs ) Send("{TAB}") Send("{SPACE}") ;Placer une icone dans le menu demarrer ( pour tous les utilsateurs ) Send("{TAB}") Send("{SPACE}") ;Placer une icone dans la barre de lancement rapide ( pour tous les utilisateurs ) Send("{TAB}") Send("{ENTER}") ;WinSetState("SAGEFormation - Assistant d'installation", "", @SW_SHOW) sleep (5000) ;population du fichier sage.ini avant ouverture primaire Local $file = FileOpen("C:Program FilesSAGEFormationsage.ini",2) IniWrite($file, "SAGEFORMATION", "CheminBD", "H:SageData") ; < -- my modifications IniWrite($file, "SAGEFORMATION", "VersionWindex", "OUI") ; < -- this one, too sleep (5000) ;BlockInput(0) EndFunc ;FIN DU SCRIPT func fin() Exit EndFunc ;ouverture de l'application Run ("C:Program FilesSageFormationSAGEFormation.exe") If that doesn't work, then you have permissions problems. Easy MP3 | Software Installer | Password Manager
gh0stid Posted August 17, 2012 Author Posted August 17, 2012 not working : .. it seem that once the installation is finish , it doesnt do the part that need creating sage.ini file and write txt to it .. it is something with my function?
gh0stid Posted August 17, 2012 Author Posted August 17, 2012 personaly i think it is cause once the install finish it try to write the ini file with the non elevated right
abberration Posted August 17, 2012 Posted August 17, 2012 If you run your AutoIt executable as an administrator, it should work. Easy MP3 | Software Installer | Password Manager
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now