bourny Posted May 29, 2008 Share Posted May 29, 2008 I am pretty sure from what I have read I cannot call 2 adlibs in a script and expect them both to work .... Is there any way around this maybe thinking out of the box ... The reason I ask is my script currently runs a tray adlib which updates the tray with messages about the script. The main purpose of this adlib is to provide a nice rotating tray icon to replace the static icon I was previously using.I have discovered this may cause an issue as in the installer function I use adlibs to handle misbehaving installers. This will inevitably cause my tray to stop adlibing therefore stop updating with messages and stop the graphic from rotating.(The rotating graphic is simply 4 icons on a rotational cycle using the adlib)I know I need the adlib for the misbehaving installers more than I need the pretty icon rotating in the tray however I need to find a new way of doing the icon rotating without using an adlib. Here is the code I use to create the rotating icon in the tray using an adlib to keep it going and updated... ***************************************************************************AdlibEnable("UpdateTray", 300)Func UpdateTray() If $StealthMode <> "1" Then TraySetToolTip($TrayMessage) ;This simply sets the tray icon depending on if an error or warning or none have occured Dim $FlagType Select Case $Ympkg_error_on = 1 $FlagType = 3 ;19 Case $WarningFlag = 1 $FlagType = 2 ;18 Case Else $FlagType = 1 ;17 EndSelect If $TipMessage <> "" Then $TipArray = StringSplit($TipMessage, ",") UBound($TipArray) If @error Then ;Do not set TrayTip to dynamic as it is empty Else ;Dynamic TrayTip has values - Decide how many $SizeOfTrayTip = UBound($TipArray) -1 Select Case $SizeOfTrayTip > 2 Select Case $SizeOfTrayTip = 3 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2] & @lf & $TipArray[3], 30, $FlagType) EndIf Case $SizeOfTrayTip = 4 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2] & @lf & $TipArray[3]& @lf & $TipArray[4], 30, $FlagType) EndIf Case $SizeOfTrayTip = 5 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2] & @lf & $TipArray[3]& @lf & $TipArray[4] & @lf & $TipArray[5], 30, $FlagType) EndIf Case $SizeOfTrayTip = 6 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2] & @lf & $TipArray[3]& @lf & $TipArray[4] & @lf & $TipArray[5] _ & @lf & $TipArray[6], 30, $FlagType) EndIf Case $SizeOfTrayTip = 7 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2] & @lf & $TipArray[3]& @lf & $TipArray[4] & @lf & $TipArray[5] _ & @lf & $TipArray[6] & @lf & $TipArray[7], 30, $FlagType) EndIf Case $SizeOfTrayTip = 8 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2] & @lf & $TipArray[3]& @lf & $TipArray[4] & @lf & $TipArray[5] _ & @lf & $TipArray[6] & @lf & $TipArray[7] & @lf & $TipArray[8], 30, $FlagType) EndIf Case $SizeOfTrayTip = 9 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2] & @lf & $TipArray[3]& @lf & $TipArray[4] & @lf & $TipArray[5] _ & @lf & $TipArray[6] & @lf & $TipArray[7] & @lf & $TipArray[8] & @lf & $TipArray[9], 30, $FlagType) EndIf Case $SizeOfTrayTip = 10 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2] & @lf & $TipArray[3]& @lf & $TipArray[4] & @lf & $TipArray[5] _ & @lf & $TipArray[6] & @lf & $TipArray[7] & @lf & $TipArray[8] & @lf & $TipArray[9] & @lf & $TipArray[10], 30, $FlagType) EndIf EndSelect Case $SizeOfTrayTip = 2 If $Silent <> 1 Then TrayTip ( "", "", 0) TrayTip($TipArray[1], $TipArray[2], 30, $FlagType) EndIf Case Else ;Do Nothing - Tray Tip has less than 2 values - At least 2 are required to build Tray Tip EndSelect EndIf EndIf Dim $ActiveIcon Select Case $WarningFlag = 1 Dim $ActiveIcon If $num = 1 Then $ActiveIcon = $Icon2 $num = 0 Else $ActiveIcon = $icon1 $num = 1 EndIf Case $ErrorFlag = 1 Dim $ActiveIcon If $num = 1 Then $ActiveIcon = $Icon2 $num = 0 Else $ActiveIcon = $icon1 $num = 1 EndIf Case Else Select Case $num = 1 $ActiveIcon = $Icon1 $num = 2 Case $num = 2 $ActiveIcon = $Icon2 $num = 3 Case $num = 3 $ActiveIcon = $Icon3 $num = 4 Case $num = 4 $ActiveIcon = $Icon4 $num = 1 EndSelect EndSelect TraySetIcon($ActiveIcon) TrayItemDelete ($item2) $item2 = TrayCreateItem($Progress) EndIf EndFunc*************************************************************************** Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2008 Moderators Share Posted May 29, 2008 (edited) The use of code tags would be great !When I need more than one adlib, I generally make an Adlibmanager function:http://www.autoitscript.com/forum/index.ph...st&p=301924http://www.autoitscript.com/forum/index.ph...st&p=211166However, you could also use something like SetTimer + DllCallBack:http://www.autoitscript.com/forum/index.ph...st&p=493146Edit:Clarity Edited May 29, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
bourny Posted May 30, 2008 Author Share Posted May 30, 2008 Thanks for that - Sounds like the kind of solution I was looking for - Will test this out in my script. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now