FMManager Posted January 6, 2019 Posted January 6, 2019 Hello. I tried to find several days answer in google and different forums but no luck. Maybe experts here can explain me how it works. It is not a secret that a lot of people use autoit to make reinstallation of software faster by avoiding press "next", "yes" and other buttons during installation procedure. It really work great but what I noticed - If I put any files which have path to type in autorun (of windows). It will spoil the path in terms of "shift" button. For example: Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("^o") WinWait ("Open", "Cancel") ControlSend("Open","","","C:\Program Files (x86)\Test.txt",1) If i start normally. It ll be correct. - C:\Program Files (x86)\Test.txt. If I put it in autorun and restart my win 7 (32 or 64). It ll be something like - C;|Program Files 9X86)|Test.txt Please advice what is the solution. Thanks in advance
Nine Posted January 6, 2019 Posted January 6, 2019 (edited) What kind of autorun are you talking about : - autorun when CD-ROM is inserted ? - autorun in registry ? - autorun in Start Menu ? - autorun as a service ? - autorun in task scheduler ? Edited January 6, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
FMManager Posted January 7, 2019 Author Posted January 7, 2019 Is any difference between them? I mean normal autorun throw start menu C:\Users\PC\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Nine Posted January 7, 2019 Posted January 7, 2019 8 hours ago, FMManager said: Is any difference between them? Yes, they all have their specificity. I will try to see if i can replicate your problem using Start Menu... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Nine Posted January 7, 2019 Posted January 7, 2019 Here is the code I used : Run("notepad.exe") WinWaitActive("[Class:Notepad]") Send("^o") $hWnd = WinWait ("Ouvrir", "", 10) Sleep (500) ControlSend($hWnd,"","","C:\Program Files (x86)\Test.txt",1) I changed it a bit your code since I am using a french environment. I had a bit of problem without the sleep (500) but it might be just a coincidence. So it works fine when I launch it manually and it works fine on auto startup. I compiled it x86, and copied the .exe into the startup folder. What version of autoit are you running ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Bresacon Posted January 7, 2019 Posted January 7, 2019 Autorun is usually referred to devices (USB, CD/DVD drives...) on insertion. Autostart is for programs that run on Windows boot. There are three ways you can autostart a program: You can create a shortcut of the program inside of the startup folder. You can get the path for all users startup folder with the @StartupCommonDir macro. Or the one for the current user with @StartupDir. You can create a scheduled task with the schtasks.exe command and the ONSTART / ONLOGON parameters. You can add the program's path -create a new string value- to the registry keys related to Run / RunOnce.
Nine Posted January 7, 2019 Posted January 7, 2019 @FMManager I just realized that the wrong characters in the send are shift characters. Exactly what I had as a problem. Looks like some other startup apps are interfering with autoit. You may want to add some sleeps in your code to delay the send...Or you could try using a simple Send (...) command instead. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
FMManager Posted January 9, 2019 Author Posted January 9, 2019 Thanks, Nine. Your idea with code below working great. I tried before put it in a sleep for 10000 or even more but still it were spoiled path. But by that line it were fixed . $hWnd = WinWait ("Ouvrir", "", 10) Topic is closed. Thank to all for participating
FMManager Posted January 21, 2019 Author Posted January 21, 2019 No.. Unfortunately it does not work for other PCs. And for this also not every time. If any other idea please advice
benched42 Posted January 21, 2019 Posted January 21, 2019 " Unfortunately it does not work for other PCs. " Are these other PCs on a domain? If so, are they Windows 10? And if so, do the individual users have admin rights? Where I work, admin rights are restricted to a very few which renders a lot of scripts I wrote in the past unusable. One example of such a script would be to add a local printer - one needs admin rights to do that. In the case of your autostart issues, one needs admin rights to write to @StartupCommonDir, but admin rights are not needed to write to @StartupDir. In addition, admin rights are required to add or change data in the "C:\Program Files", "C:\Program Files (x86)" and "C:\Program Data" folders. Who lied and told you life would EVER be fair?
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