| 1. |
Solve : Batch keypress help? |
|
Answer» Ok so i have a program that closes every 30 minutes and i wanted it to loop so it goes infinity. first my thought camed to that i could make it loop every 30 min but then i remembered that i have to set it up after every startup so now i wonder if any of u experienced bat coders could make me a bat code or say the commands to make it happen This would be a lot more easily done in a VBScript. I'm currently getting my feet wet with VB, so I do not know all of the nuances about the coding, but as a rough go at it, try:Quote from: sobbo90 on November 03, 2011, 01:36:50 PM wont work ?= :S any help please :S You need quotation marks and a file extension, I think. Like: Code: [Select]WshShell.Run "C:\blah\blah\blah\blah.exe", 1Syntax error, line 3 of the script. Ah I see Cheezey beat me to it. The shell object expects a string. Strings have quotes. If the program you want to run is not on the PATH then you need the full path, filename and extension. Quote from: Cheezey on November 03, 2011, 02:00:31 PM You need quotation marks and a file extension, I think.Ok fixed that and now i did put it in the same directory did fix quotes and get full location but it says it cant find the file This is error picture : Uploaded with ImageShack.us The Fel:(Error) means that it cannot find the file This is the code Code: [Select]Set WshShell = WScript.CreateObject("WScript.Shell") Do WshShell.Run "C:\Users\Linus\Desktop\wowrob\WowRobot Evolution", 1 WshShell.Sleep 60 WshShell.SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}" WshShell.Sleep 1000 WshShell.SendKeys "{TAB}{TAB}{ENTER}" WshShell.Sleep 1000 WshShell.SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}" WshShell.Sleep 1860000 LoopIs WowRobot Evolution a program file? Quote from: Salmon Trout on November 03, 2011, 02:04:16 PM Syntax error, line 3 of the script. Ah I see Cheezey beat me to it. The shell object expects a string. Strings have quotes. If the program you want to run is not on the PATH then you need the full path, filename and extension. OKEY tried to fix this but now i get error where it says that it cant find it even thoe i did put the script in same directory and did full path length this is code Code: [Select]Set WshShell = WScript.CreateObject("WScript.Shell") Do WshShell.Run "C:\Users\Linus\Desktop\wowrob\WowRobot Evolution", 1 WshShell.Sleep 60 WshShell.SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}" WshShell.Sleep 1000 WshShell.SendKeys "{TAB}{TAB}{ENTER}" WshShell.Sleep 1000 WshShell.SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}" WshShell.Sleep 1860000 Loop Uploaded with ImageShack.us At the "Fel" (ErroR) it says cannot find the file. Quote from: Salmon Trout on November 03, 2011, 02:26:33 PM Is WowRobot Evolution a program file?Quote from: Salmon Trout on November 03, 2011, 02:26:33 PM Is WowRobot Evolution a program file?Filetype is Program.exetestet to add .exe on the end of the file path. no success Quote from: Salmon Trout on November 03, 2011, 02:29:42 PM Okey i changed some directory names and file names etc... do u see anything in this script that should't work? Code: [Select]Set WshShell = WScript.CreateObject("WScript.Shell") Do WshShell.Run "C:\Users\Linus\Desktop\wowrob\hejsan\Enkel.exe", 1 WshShell.Sleep 60 WshShell.SendKeys "{TAB}{ENTER}" WshShell.Sleep 1000 WshShell.SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}" WshShell.Sleep 1000 WshShell.SendKeys "{TAB}{TAB}{ENTER}" WshShell.Sleep 1000 WshShell.SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}" WshShell.Sleep 1860000 Loopdoes this file and path exist exactly as SHOWN? "C:\Users\Linus\Desktop\wowrob\hejsan\Enkel.exe" Don't PM for special help. You should wait for Raven to answer, it's his script. Shouldn't it be Wscript.sleep? Quote from: Salmon Trout on November 03, 2011, 02:55:21 PM does this file and path exist exactly as shown? Thanks now its no error and yes it did i dont know if i did get dot or something in it cause now it launches and same with sleep command. i only have one problem left after i started the program i need it to get "TARGETED" as the window that i am on so that the tab and enter have any effect cause now it only starts and then it presses tab and enter in the same folder as the script Yeah sorry for that wont do that again |
|