Jump to content

samkshah

Members
  • Posts

    8
  • Joined

  • Last visited

samkshah's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I always get Error 6 with above code. Am I missing anything? I checked file attributes and it is not a read only file. Thanks.
  2. herewasplato, Thanks. Let me try that and will update you once done. Appreciate your quick help. samkshah
  3. Hello, I appreciate any help on this. I need to replace a line in a file, however the complete line is unknown, only starting characters are known. Any idea on how to replace the entire line based on if starting word matches my search criteria? Here is a sample code and the output that I need. #include <File.au3> $retval = 0 $find = "BEFORE*";line starting with "BEFORE" - rest of words in that string are unknown. Not sure if I can use "*" to wildcard everything after BEFORE $replace = "AFTER" $filename = "C:\test.txt" $retval = _ReplaceStringInFile($filename,$find,$replace) if $retval = -1 then msgbox(0, "ERROR", "The pattern could not be replaced in file: " & $filename & " Error: " & @error) exit else msgbox(0, "INFO", "Found " & $retval & " occurances of the pattern: " & $find & " in the file: " & $filename) endif
  4. MsCreatoR, Thank you much. I appreciate your quick help. Best, samkshah
  5. Hello, I am trying to kill a process, however after exiting that process, taskbar still shows icon. If I move mouse manually over the icon, it goes away. Is there a way to automatically refresh taskbar icons after killing process? Here is the code that I am using: local $process = "abc.exe" If ProcessExists($process) Then RunAsSet($username, @LogonDomain, $password, 1) RunWait(@ComSpec & ' /c taskkill /F /T /IM ' & $process, "", @SW_HIDE) RunAsSet() EndIf I have to use RunAsSet to escalate current user permissions to admin level. Please let me know if there is any alternative. Any inputs is appreciated. Thank you much, samkshah
  6. Thanks for quick response. Let me include my complete code in my next post. My requirement is to run entire script as admin user and not only "Run" or "Runwait" commands. Since I am replacing text in a text file which is in "Program Files" directory, I need to run entire script as admin user. I am sorry for my mistake in previous thread where I told that I was using latest version. I now downloaded a latest beta version and still it's an issue. Thank you much, samkshah
  7. FYI: current logged in user also has admin rights. However script does not work if a logged on user does not have admin rights.
  8. Is running RunAsSet() and escalating to admin rights still an issue? I came across this http://www.autoitscript.com/forum/index.php?showtopic=6544 bug report and looks like it has not been updated since long. I am trying to use RunAsSet() in my script to escalate rights to admin account and looks like it does not work. Am I doing anything wrong or is still an issue? Here is my algorithm: local $escalaterights $escalaterights = RunAsSet("adminuser", @LogonDomain, "adminpass", 0) If $escalaterights = 0 Then writeLog("OS does not support RunAsSet function") exitewitherr() EndIf If IsAdmin() then writeLog("rights escalated to account: " & @LogonDomain & "\" & @UserName) else writeLog("could not escalate admin rights") exitwitherr() EndIf Above code always returns following text in log file: "rights escalated to account: domain\currentuser" instead of "rights escalated to account: domain\adminuser" Any idea on why it's not working or any alternative method that I can use? FYI: This script is for win xp sp2, win 2000 and win2k3 machines. I am using latest version of AutoIT downloaded yesterday - v3.2.2.0 beta Thank you much, samkshah
×
×
  • Create New...