Sly Posted January 16, 2006 Share Posted January 16, 2006 (edited) Just started and im trying to get a program to run heres my script ... ; This is my first script MsgBox(0, "Msn Launcher!", "Start Msn") Run ( "msmsgs.exe", "C:\Program Files\Messenger" ) WinWaitActive ("Windows Messenger") Whats wrong with it? Sorry I just started today I would appreciate any help. I get this Line 3 Error: unable to execute the external program The system cannot find the file specified Edited January 16, 2006 by Sly Link to comment Share on other sites More sharing options...
greenmachine Posted January 16, 2006 Share Posted January 16, 2006 I remember someone else asking a similar question a while ago... Here's the deal. The "working dir" doesn't work like that. What you need is just to take what you have in working dir, attach your file name to the end of it, and run it. In other words: Run ("C:\Program Files\Messenger\msmsgs.exe") That's it. Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 16, 2006 Share Posted January 16, 2006 you need to write is like: run ( "C:\Program Files\Messenger\msmsgs.exe" ) From the help file: Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]]) "working directory" isn't the same thing as "path of the executable". LD Link to comment Share on other sites More sharing options...
Oxin8 Posted January 16, 2006 Share Posted January 16, 2006 And greenmachine beats out LondonNDIB by a solid minute! Good race you two! ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Sly Posted January 16, 2006 Author Share Posted January 16, 2006 (edited) Thanks for the fast help. It worked! Edited January 16, 2006 by Sly Link to comment Share on other sites More sharing options...
greenmachine Posted January 16, 2006 Share Posted January 16, 2006 And greenmachine beats out LondonNDIB by a solid minute! Good race you two!I may have won this race, but you have 5 of the 6 most recent posts. That's a little more impressive. Link to comment Share on other sites More sharing options...
Oxin8 Posted January 16, 2006 Share Posted January 16, 2006 I'm bored and stuck on a level of the current game I'm addicted too... ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Sly Posted January 16, 2006 Author Share Posted January 16, 2006 Another question if my script is going for a while and looping fine. What would i use to have it stop looping after 5 mins (i know what i want to to do in between) and then say restart looping? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2006 Moderators Share Posted January 16, 2006 (edited) $Timer = TimerInit() While 1 ;Script Sleep(10) If TimerDiff($Timer) / 1000 / 60 >= 5 Then SomeFuncToDoSomething() $Timer = TimerInit() EndIf Wend Func SomeFuncToDoSomething() ;Do Something EndFunc; Return back to loop and restart timer for another 5 minutes Edit: I didn't see you wanted to go back to the loop again: Edited code above. Edited January 16, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Sly Posted January 16, 2006 Author Share Posted January 16, 2006 Thanks alot i feel like a noob Link to comment Share on other sites More sharing options...
greenmachine Posted January 16, 2006 Share Posted January 16, 2006 I see Oxin8 is posting, but I'm going to start this anyway. Funcs are really useful. Example: MyFunc() ; LOTS O' CODE EndFunc Then, you can do the While loop, call your func whenever, exit the loop, call your func some more, etc etc. As long as you don't exit the script, you can go back to that func (if it's around the loop then it'll go back into the loop) as often as you need. Link to comment Share on other sites More sharing options...
Oxin8 Posted January 16, 2006 Share Posted January 16, 2006 I can think of a few ways to do this..... While 1 For $i = 1 to 30000;300000ms = 5 min ;your stuff sleep(10); any sleep time. just make sure sleeptime * endnumber on for loop = 300000ms Next ;stuff to do every 5 minute WEnd AdlibEnable ( "stufftodo", 300000) While 1 ;your stuff WEnd Func stufftodo() ;stuff for every 5 min EndFunc Dim $i $i = 1 While 1 $i = $i + 1 ;your stuff If $i = 30000 Then ;stuff for every 5 min $i = 1 EndIf Sleep(10); same time*loop count concept as first one WEnd lol.... greenmachine... ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2006 Moderators Share Posted January 16, 2006 (edited) I can think of a few ways to do this..... While 1 For $i = 1 to 30000;300000ms = 5 min ;your stuff sleep(10); any sleep time. just make sure sleeptime * endnumber on for loop = 300000ms Next ;stuff to do every 5 minute WEnd AdlibEnable ( "stufftodo", 300000) While 1 ;your stuff WEnd Func stufftodo() ;stuff for every 5 min EndFunc Dim $i $i = 1 While 1 $i = $i + 1 ;your stuff If $i = 30000 Then ;stuff for every 5 min $i = 1 EndIf Sleep(10); same time*loop count concept as first one WEnd lol.... greenmachine... None of those are correct for time functions. I can go through 300,000 loops in less than a minute on my computer. Edit: The AdlibEnable() will work, I totally missed that one. Run this to see how long it takes yours... took mine 46.82 seconds to do 300,000 loops: $timer = TimerInit() Local $i While 1 $i = $i + 1 ToolTip($i, 0, 0) If $i = 300000 Then ExitLoop WEnd MsgBox(0, TimerDiff($timer) / 1000, TimerDiff($timer) / 1000 / 60) This will show you what I mean. Edited January 16, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Oxin8 Posted January 16, 2006 Share Posted January 16, 2006 I think you failed to notice the 'sleep's I had written in... So i did some testing and my 2 loop examples would have taken long that the wanted wait time. The longer the 'sleep' time is, the more accurate my examples work. I'll definately start using the timer thing from now on though but don't be so quick to assume I was ignorant enough to simply loop 300000 times... ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2006 Moderators Share Posted January 16, 2006 (edited) I think you failed to notice the 'sleep's I had written in... So i did some testing and my 2 loop examples would have taken long that the wanted wait time. The longer the 'sleep' time is, the more accurate my examples work. I'll definately start using the timer thing from now on though but don't be so quick to assume I was ignorant enough to simply loop 300000 times...LOL, would never call you ignorant, ignorance would be someone telling you that your example has logic flaws, and you ignoring it and continueing to keep doing what you do. I'm in no way an expert and don't mean to come off snub as I sometimes do, but if you read my edit, as I said, your AdlibEnable() example would work also, and actually would be less code than my TimerInit() option.Edit:**Grammar Edited January 16, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Oxin8 Posted January 16, 2006 Share Posted January 16, 2006 (edited) Point is, the three examples I gave work, just less efficiently and accurately than others. EDIT: It's 2:32 am here. I'm probably just being cranky and should go to sleep. Sorry Smoke_N. Edited January 16, 2006 by Oxin8 ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2006 Moderators Share Posted January 16, 2006 Point is, the three examples I gave work, just less efficiently and accurately than others.Ok man... I'm not posting the above or below to get in a pissing contest.1. I said what I said about the code you posted because... you couldn't make examples one and three into a UDF because of different computer speeds. So yes, they time out after a certain period of time, but you have to sit there and figure out how long that time is. Which we all use AutoIt for automation and making things as lazy as possible 2. Example 2: AdlibEnable() is a wonderful solution.3. It was my mistake for not looking that you had a Sleep(10) there.I post things all the time that are inefficient and someone cleans it up behind me, but to your defense, Most do it more tactfully that what I came across, I meant no harm nor foul and apologize if it came off rude or disconcerning. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Sly Posted January 16, 2006 Author Share Posted January 16, 2006 (edited) MouseClick ("Mouse1" "X: 512 Y: 377" "1" "0") That is not working and then I try it scites way and I get this Its in my attachment any help is cool ive been toying with it for a hourMouse_click.bmp Edited January 16, 2006 by Sly Link to comment Share on other sites More sharing options...
greenmachine Posted January 16, 2006 Share Posted January 16, 2006 (edited) MouseClick ("Mouse1" "X: 512 Y: 377" "1" "0") 1. You need commas between parameters. 2. Numbers don't go in quotes unless they're supposed to be strings. In this case, they aren't. 3. I don't know if Mouse1 is the actual button name... but "Primary" definitely works. 4. No need to say x: and y: in the x and y parameters. 5. It should end up like this: MouseClick ("primary", 512, 377, 1, 0) 6. Did you try the helpfile? Edited January 16, 2006 by greenmachine Link to comment Share on other sites More sharing options...
Sly Posted January 16, 2006 Author Share Posted January 16, 2006 Next time ill read some more through the help file. 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