Sign in to follow this  
Followers 0
vickerps

Closing A File

5 posts in this topic

I am using winclose to close a text file

How do i get it to say yes to saving the changes to the file

I have sent keystrokes down to do it however if the text file hasn't changed then that keystroke will still be done.

Share this post


Link to post
Share on other sites



Or:

Winclose("MyTextFile")
Sleep(1000)
while winexists("Save Changes")
ControlClick("Save Changes","","&Yes")
wend
;rest of script

Adlib is a good way to do it though. It basically keeps running the adlib function over and over as long as the script is running and there is no AutoIt MsgBox up.

It also could cause problems if you had more than one program running, as in this case it would always save no matter what program if this was windows default save question box.

I have adlib up when there are a lot of couldbe popups:

AdlibEnable("FreakWinHandler")
; all my code



Func FreakWinHandler()
   If WinExists("Save Changes") Then
       ControlClick("Save Changes","","&Yes")
   EndIf
   If WinExists("Do you want to convert to DOS") Then
       ControlClick("Do you want to convert to DOS","","&Yes")
   EndIf
   If WinExists("Free Offer") Then
       winclose("Free Offer")
   EndIf
EndFunc

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

lol,

If WinExists("Free Offer") Then

      winclose("Free Offer")

would that be for a pop-up? :whistle:

i like what i hear about the adlib funciton. i will look into it with more depth later on. will running it slow down the speed of the script running?

i know it would have to depend on what the adlib function was supposed to do, but if it was just empty would it slow things down?

like this:

Func FreakWinHandler()

EndFunc

:cheer: awww...wheres the chick?

Share this post


Link to post
Share on other sites

you can also slow down the amount of adlib functions with the optional time:

AdlibEnable ( "function" [,time] );Default is 250 ms.

AdlibEnable("FreakWinHandler",1000) ; run it only once every second

AdlibEnable("FreakWinHandler",2000) ; run it once every 2 seconds

; code code code

AdlibDisable ( )

;run program code

; do something in program

AdlibEnable("FreakWinHandler")

; winclose("something")

; finish up stuff

AdlibDisable ( )

; ect

And yes, that was an example of anoying popups.

I also love AutoIt for ultra fast clicks on Freeware. ex:

run("Freeware program")
winwaitactive("Anoying wait screen")
ControlEnable ( "Anoying wait screen", "", "Wait10secondscontrol1" )
ControlClick ( "Anoying wait screen", "", "Wait10secondscontrol1")

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I also love AutoIt for ultra fast clicks on Freeware. ex:

I may or may not use AutoIt for that sometimes, also. :whistle:

Edited by Valik

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  
Followers 0