Sign in to follow this  
Followers 0
gh0stid

runas and personal func() problem

5 posts in this topic

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

#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")

Share this post


Link to post
Share on other sites



You really should be using IniWrite instead. Try it this way:

#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.


RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

personaly i think it is cause once the install finish it try to write the ini file with the non elevated right

Share this post


Link to post
Share on other sites

If you run your AutoIt executable as an administrator, it should work.


RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

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  
Followers 0