Autoit script doesn't run properly when started from BAT file - how to set workingdir?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,144
Reaction score
10,489
I'm using Windows 10. I have a computer which automatically restarts once every 24 hours, and when it starts I have a BAT file in the Startup folder which automatically starts and opens about 60 programs, and in the end it opens an AutoIT script. But the AutoIT script doesn't run properly when I start it using the BAT file, and in particular these commands:

Code:
Local $Magick = 'magick convert "C:\Users\Me\Desktop\Folder\image.jpg" -crop +125+25 -crop -125-25 image1.png"'
RunWait(@ComSpec & " /c " & $Magick)

So the AutoIt script starts, it does the sleeps, it does the clicks, but it never runs these lines of code. I tried using the raw AutoIT file, I also tried compiling it as x86 and x64, and it doesn't work.

When I start the script manually, then it works fine.

I was told that I should set the Workingdir (parameter 2) to the proper path in the RunWait(), and that may fix it. But I'm not coder and after googling and trying some things, I don't know how to set the workingdir.

Can anyone tell me how to do it?
 
You should be able to set the workingdir by doing

Code:
RunWait(@ComSpec & " /c " & $Magick, "C:\Users\Me\Desktop\Folder")
 
You should be able to set the workingdir by doing

Code:
RunWait(@ComSpec & " /c " & $Magick, "C:\Users\Me\Desktop\Folder")

That worked! You're the best bro! The best around! :D

img404.jpg
 
Back
Top