Sign in to follow this  
Followers 0
higginsj

help needed with au3 script

7 posts in this topic

As you might guess as you read on i am new to scripting, I have created a few scripts but i am stuck on this one.

I am trying to change the view of my printers and faxes folder to show printers by location and in groups, below is the script that i have created which does as i said BUT i want to add this to quite a few pcs to run on startup( which is not a problem - works fine!) BUT this works the first time then undoes it next startup is there an ENDIF i can add in to skip the sort in groups if it is already selected.

Thanks in advance for any help and infomation

*****************************************************

;this opens printers and faxes in maximised mode

Run("control.exe printers", "", @SW_MAXIMIZE)

Sleep(5000)

;This sends the keystrokes view > arrange icon by > show in groups

Send("!v")

Send("i")

Send("g")

Sleep(100)

;this sends the keystrokes view > arrange icons by > location

Send("!v")

Send("i")

Send("l")

Sleep(100)

; Now quit by pressing Alt-f and then c (File menu -> Close)

Send("!f")

Send("c")

;closes printers and faxes folder

WinwaitClose("Printer and Faxes")

; Finished!

************************************************************

Thanks again

Jason :">

Share this post


Link to post
Share on other sites



I don't get the problem, you're saying that it stays sorted once it's sorted the first time. Why can't you just manually go in Control Panel and do it once, and then it will stick that way. Or just don't make it on startup, just click it when needed...


If I post a code or snippet, please tell me what I did wrong and/or what I can do better. Tell me my code/idea sucks, if it does. If I ask for help, refrain from only telling me to search the help file and/or the forums. I will search before asking, I just may not have searched with good keywords. If I say that I will look into something or fix something later, understand that I am most likely lying.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Global $Groupman = HotKeySet ( "{end}", "groupman" )
Global $locman = HotKeySet ( "{del}", "locman" )
Global $exi = HotKeySet ( "{pgup}", "exi" )
;this opens printers and faxes in maximised mode
Run("control.exe printers", "", @SW_MAXIMIZE)

;idle here
While 1
sleep(365*24*60*60*1000)
WEnd

Func groupman ()
;This sends the keystrokes view > arrange icon by > show in groups
Send ("!v")
Send("i")
Send("g")
Return
EndFunc

Func locman ()
;this sends the keystrokes view > arrange icons by > location
Send("!v")
Send("i")
Send("l")
return
EndFunc
Func exi ()
; Now quit by pressing Alt-f and then c (File menu -> Close)
Send("!f")
Send("c")
exit
EndFunc

; Finished!

try that!

-edited forgot the endfunc,

forgot the idle

Edited by backstabbed

tolle indicium

Share this post


Link to post
Share on other sites

I don't get the problem, you're saying that it stays sorted once it's sorted the first time. Why can't you just manually go in Control Panel and do it once, and then it will stick that way. Or just don't make it on startup, just click it when needed...

[/quote

I want this to be on startup on all pc's. just in case users change the way printers and faxes shows the printers, but if the user does not changes settings i dont want the script to run again and take the settings off

Share this post


Link to post
Share on other sites

Thanks Backstabbed for you quick responce much appreiciated , i will have a look and post back if all is well

thanks again ;)

Share this post


Link to post
Share on other sites

I have tried the script you modified for me but it runs very slow , is there any way i can speed it up?

Thanks again

Share this post


Link to post
Share on other sites

You can use Auto3Lib to read the settings of the menus and only set them if they are not set the way you want. There is a demo script that shows how to set the status bar this way to prevent toggling it every time the script is run.


Auto3Lib: A library of over 1200 functions for AutoIt

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