Traskiz Posted July 2, 2014 Share Posted July 2, 2014 (edited) Hello, I cant read ini file(ini.ini), when I Run that file(2.exe) as administrator from first script (1.exe). How I could do that? Tried everything nothing works 1.exe: Global $sUserName = "Administrator" Global $sPassword = "" RunAs($sUserName, @ComputerName, $sPassword, 0, "2.exe", "", @SW_SHOWMAXIMIZED) 2.exe: $text = iniread("ini.ini", "ini", "ini", "default") MsgBox(4096, "title", $text) IF $text = "default" Then MsgBox(4096, "title", "no ini") EndIf ini.ini: [ini] ini=yes PLEASE HELP. I need this for my real script... And I need ini files for configuration Edited July 2, 2014 by Traskiz Link to comment Share on other sites More sharing options...
JohnOne Posted July 2, 2014 Share Posted July 2, 2014 re you certain that you should not write to ini in 1.exe? If not then be more clear in your problem. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Traskiz Posted July 2, 2014 Author Share Posted July 2, 2014 re you certain that you should not write to ini in 1.exe? If not then be more clear in your problem. Its not working... I tried :/ I dont understand how to give 2.exe that ini file, when I use Run() instead of RunAs() its working perfectly :/ Link to comment Share on other sites More sharing options...
BrewManNH Posted July 2, 2014 Share Posted July 2, 2014 Where is the ini file located, and does the Administrator have access to that location? In other words is it on a mapped drive that Administrator doesn't have? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Traskiz Posted July 2, 2014 Author Share Posted July 2, 2014 Where is the ini file located, and does the Administrator have access to that location? In other words is it on a mapped drive that Administrator doesn't have? All files is in C:ini folder. Can it be Auto IT bug? Link to comment Share on other sites More sharing options...
BrewManNH Posted July 2, 2014 Share Posted July 2, 2014 Try using full path names to the ini file to make sure the script can find it. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Traskiz Posted July 2, 2014 Author Share Posted July 2, 2014 Try using full path names to the ini file to make sure the script can find it. Tried that Please, could you try it yourself? I have no clue how to fix it... It looks like a bug. Link to comment Share on other sites More sharing options...
BrewManNH Posted July 2, 2014 Share Posted July 2, 2014 I did try it, it works if you use the full path to the INI file in 2.exe. $text = IniRead(@ScriptDir & "\ini.ini", "ini", "ini", "default") ; <<<<<<<<< assumes the ini file is in the same directory as the exe MsgBox(4096, "title", $text) If $text = "default" Then MsgBox(4096, "title", "no ini") EndIf If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
j0kky Posted July 2, 2014 Share Posted July 2, 2014 What happens if you put #requireAdmin at the top of 2.exe? Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
Traskiz Posted July 2, 2014 Author Share Posted July 2, 2014 I did try it, it works if you use the full path to the INI file in 2.exe. $text = IniRead(@ScriptDir & "\ini.ini", "ini", "ini", "default") ; <<<<<<<<< assumes the ini file is in the same directory as the exe MsgBox(4096, "title", $text) If $text = "default" Then MsgBox(4096, "title", "no ini") EndIf Oh! thank you very much! I tried that, but I forget to write this YOU SAVED ME What happens if you put #requireAdmin at the top of 2.exe? Tried, Nothing. I dont use this... Link to comment Share on other sites More sharing options...
BrewManNH Posted July 2, 2014 Share Posted July 2, 2014 Forgetting the leading "" is an easy thing to miss, happened to me plenty. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
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