Jump to content
Sign in to follow this  
Tuna

troubleshoot script

Recommended Posts

Tuna

I was given a script but can't get it to run. Could someone break it down so I can figure out why it doesn't run for me?

Thanks for any help

the lines with the < preceding them do not have that symbol, they have the gray box and bar so I guess they are rem statements?

<#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

<#AutoIt3Wrapper_outfile=One that is scheduled\Evony.exe

<#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Dim $PID = 0

$PID = ProcessExists("iexplore.exe") ; Will return the PID or 0 if the process isn't found.

<Do

< ProcessClose($PID)

< $PID = ProcessExists("iexplore.exe")

Until $PID = 0

Run ("C:\Program Files (x86)\Internet Explorer\iexplore.exe", @SW_MAXIMIZE)

Share this post


Link to post
Share on other sites
Calistoga

You forgot the correct second argument for Run(), which is "workingdir", not show_flag.

Anyways, I revised your code a little and tried to comment everything properly. Ask if you got any questions ;)

#AutoIt3Wrapper_outfile=Evony.exe; This tells the compiler to name the finished exe "Evony.exe".

Local $PID = ProcessExists("iexplore.exe"); Will return the PID or 0 if the process isn't found.

While ($PID <> 0); This loop will keep going until $PID equals 0.

    If (ProcessClose($PID) <> 1) Then ContinueLoop; If ProcessClose() returns any other value that 1, it failed to close the process.

    $PID = ProcessExists("iexplore.exe"); If the process was found, $PID should now contain its handle (hWnd).

WEnd; Now we loop up to "While" and check whether $PID is still not 0.

Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe", "", @SW_MAXIMIZE); Now we're going to run Internet Explorer.

Exit; That's it.
Edited by Encoded

Share this post


Link to post
Share on other sites
Tuna

Thanks alot. I got rid of the loop since it doesn't make sense to me. Why continue looking for a file? it's either there or it's not. and with your changes it worked fine.

haven't done stuff like this since I played with basic in the 80's. gonna take awhile to get the hang of it

Share this post


Link to post
Share on other sites
JohnOne

Why continue looking for a file? it's either there or it's not.

Your code suggested that their may be multiple instances of IE open, if that could be the case then you are going to need a loop of some sort.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Tuna

That would explain the loop then. thanks. removing was best then because I want to open a new window when the script runs

Share this post


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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.