Jump to content

Autoit script doesn't run properly when started from BAT file


Recommended Posts

1 hour ago, bobomb said:

Yea but you didnt learn what @WorkingDir was... Use that instead of the quoted path. If you are running from the same folder.

I highly recommend going back to the help page and looking at the now working section.. It might be hard to understand without context but once u have something working you should be able to see whats going on.. @WorkingDir is a variable you can use not just a (Value) you can enter

Okay, I think I understand.

I don't see a "now working section" here - https://www.autoitscript.com/autoit3/docs/functions/RunWait.htm

Unless you're talking about the code in the end.

But anyway, so I can't test it right now, but I think what you're saying is something like this:

RunWait(@ComSpec & " /c " & $Magick, @Workingdir)
RunWait(@ComSpec & " /c " & $Magick @Workingdir)
RunWait(@ComSpec, @Workingdir & " /c " & $Magick)

If that's the case, I can see how that's superior to what I did. With what I did if I ever move the script I'll have to edit that line. But with this I wouldn't have to.

Anyway, maybe I'm right, maybe I'm wrong, but what I got now works and I barely have time to breathe, so I won't be testing it at the moment. But I may test it at some point. I'll leave this thread bookmarked in my browser to remind me. Thanks :)

Link to post
Share on other sites

Here is a valid (although ugly) Run line..

Run("cmd /c notepad.exe", @WorkingDir) ; opens notepad using console ; Using @WorkingDir ; Immediately runs the next line in the program

or

RunWait(@ComSpec & ' /c ' & 'notepad.exe', @WorkingDir, @SW_HIDE) ; opens notepad using cosole with @SW_HIDE flag so you will not see the console window ; Using @WorkingDir ; Waits for the program to close before continuing to the next line

They are both functional ways to use run commands

Edited by bobomb
Link to post
Share on other sites
1 hour ago, Scorpys said:

I don't see a "now working section" here - https://www.autoitscript.com/autoit3/docs/functions/RunWait.htm

I mean look at the working section of code you have and compare it to what the help page is showing you... The RunWait help a little tough after looking because there are no SW_HIDE @ComSpec or @WorkingDir examples.. I did not notice that before, but the Run help remarks and example shows a little more with an opt flag included.. It takes time, looking around at other peoples code can be helpful too.. 

https://www.autoitscript.com/autoit3/docs/functions/Run.htm

Also you should definately use the SciTE editor located here: https://www.autoitscript.com/cgi-bin/getfile.pl?../autoit3/scite/download/SciTE4AutoIt3.exe

Screenshot 2021-12-19 105518.png

Screenshot 2021-12-19 105423.png

Edited by bobomb
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...