alex OF DEATH Posted June 15, 2007 Share Posted June 15, 2007 Func Down() TraySetIcon ( @ScriptDir & "SDown.bmp" ) Endfunc Func Up() TraySetIcon ( @ScriptDir & "Sup.bmp" ) Endfunc TraySetIcon won't change the icon. Is it not allowed to be a .bmp or something? Yes, that is just a portion of the actual script. So don't say anything along the lines of "lulz, joo has to call teh function first" Some more information: I'm trying to make a script to tell if a server is up. So far, it works. But when the server is down, I want the Tray icon to be a red square, and when it is up, a green square. The TraySetIcon just won't work for me. Although I know it will probably be something stupid. Help? :\ Link to comment Share on other sites More sharing options...
poisonkiller Posted June 15, 2007 Share Posted June 15, 2007 Lets say, that you script is in C:\Program Files directory. Your script will read it like this: Func Down() TraySetIcon ( "C:\Program FilesSDown.bmp" ) Endfunc Func Up() TraySetIcon ( "C:\Program FilesSup.bmp" ) Endfunc Try putting "\" between @ScriptDir and .bmp file name. If that doesn't work, I don't know what's wrong. Link to comment Share on other sites More sharing options...
alex OF DEATH Posted June 15, 2007 Author Share Posted June 15, 2007 Lets say, that you script is in C:\Program Files directory. Your script will read it like this: Func Down() TraySetIcon ( "C:\Program FilesSDown.bmp" ) Endfunc Func Up() TraySetIcon ( "C:\Program FilesSup.bmp" ) Endfunc Try putting "\" between @ScriptDir and .bmp file name. If that doesn't work, I don't know what's wrong. That would be a problem, yes... But still, the tray icon doesn't change :\ Link to comment Share on other sites More sharing options...
poisonkiller Posted June 15, 2007 Share Posted June 15, 2007 (edited) 1st stupid question: have you included <Constants.au3> to your script? In help file it seems it's needed... 2nd stupid question: when you are testing your script, are you sure you call these functions (Down(), Up())? Edited June 15, 2007 by poisonkiller Link to comment Share on other sites More sharing options...
i542 Posted June 15, 2007 Share Posted June 15, 2007 (edited) 1st stupid question: have you included <Constants.au3> to your script? In help file it seems it's needed...2nd stupid question: when you are testing your script, are you sure you call these functions (Down(), Up())? Probably the first icon is down and second up.Tray commands are internal AutoIt commands so they should work without includes.EDIT: Try to save to GIF or JPEG. Edited June 15, 2007 by i542 I can do signature me. Link to comment Share on other sites More sharing options...
poisonkiller Posted June 15, 2007 Share Posted June 15, 2007 Then why are Constants.au3 included in every Tray example? Link to comment Share on other sites More sharing options...
alex OF DEATH Posted June 15, 2007 Author Share Posted June 15, 2007 Neither Including Constants.au3 nor saving the images as .jpg worked. >:| Link to comment Share on other sites More sharing options...
i542 Posted June 15, 2007 Share Posted June 15, 2007 Then why are Constants.au3 included in every Tray example?expandcollapse popup#include-once ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.2 ; Author(s): Jeremy Landes <jlandes at landeserve dot com> ; David Nuttall <danuttall at rocketmail dot com> ; Philip Gump <cyberslug at autoitscript dot com> ; Holger Kotsch <Holger dot Kotsch at GMX dot de> ; Dave... ; Description: This file is meant to be included in an AutoIt v3 script to ; provide access to these constants. ; ; ------------------------------------------------------------------------------ ;============================================== ; AutoIt Options Constants ;============================================== ; Sets the way coords are used in the mouse and pixel functions Global Const $OPT_COORDSRELATIVE = 0 ; Relative coords to the active window Global Const $OPT_COORDSABSOLUTE = 1 ; Absolute screen coordinates (default) Global Const $OPT_COORDSCLIENT = 2 ; Relative coords to client area ; Sets how errors are handled if a Run/RunWait function fails Global Const $OPT_ERRORSILENT = 0 ; Silent error (@error set to 1) Global Const $OPT_ERRORFATAL = 1 ; Fatal error (default) ; Alters the use of Caps Lock Global Const $OPT_CAPSNOSTORE = 0 ; Don't store/restore Caps Lock state Global Const $OPT_CAPSSTORE = 1 ; Store/restore Caps Lock state (default) ; Alters the method that is used to match window titles Global Const $OPT_MATCHSTART = 1 ; Match the title from the start (default) Global Const $OPT_MATCHANY = 2 ; Match any substring in the title Global Const $OPT_MATCHEXACT = 3 ; Match the title exactly Global Const $OPT_MATCHADVANCED = 4 ; Use advanced window matching (deprecated) ;============================================== ; File Constants ;============================================== ; Indicates file copy and install options Global Const $FC_NOOVERWRITE = 0 ; Do not overwrite existing files (default) Global Const $FC_OVERWRITE = 1 ; Overwrite existing files ; Indicates file date and time options Global Const $FT_MODIFIED = 0 ; Date and time file was last modified (default) Global Const $FT_CREATED = 1 ; Date and time file was created Global Const $FT_ACCESSED = 2 ; Date and time file was last accessed ; Indicates the mode to open a file Global Const $FO_READ = 0 ; Read mode Global Const $FO_APPEND = 1 ; Write mode (append) Global Const $FO_OVERWRITE = 2 ; Write mode (erase previous contents) Global Const $FO_BINARY = 16 ; Read/Write mode binary Global Const $FO_UNICODE = 32 ; Write mode Unicode UTF16-LE Global Const $FO_UTF16_LE = 32 ; Write mode Unicode UTF16-LE Global Const $FO_UTF16_BE = 64 ; Write mode Unicode UTF16-BE Global Const $FO_UTF8 = 128 ; Write mode Unicode UTF8 ; Indicates file read options Global Const $EOF = -1 ; End-of-file reached ; Indicates file open and save dialog options Global Const $FD_FILEMUSTEXIST = 1 ; File must exist Global Const $FD_PATHMUSTEXIST = 2 ; Path must exist Global Const $FD_MULTISELECT = 4 ; Allow multi-select Global Const $FD_PROMPTCREATENEW = 8 ; Prompt to create new file Global Const $FD_PROMPTOVERWRITE = 16 ; Prompt to overWrite file ;============================================== ; Keyboard Constants ;============================================== ; Changes how keys are processed Global Const $KB_SENDSPECIAL = 0 ; Special characters indicate key presses (default) Global Const $KB_SENDRAW = 1 ; Keys are sent raw ; Sets the state of the Caps Lock key Global Const $KB_CAPSOFF = 0 ; Caps Lock is off Global Const $KB_CAPSON = 1 ; Caps Lock is on ;============================================== ; Message Box Constants ;============================================== ; Indicates the buttons displayed in the message box Global Const $MB_OK = 0 ; One push button: OK Global Const $MB_OKCANCEL = 1 ; Two push buttons: OK and Cancel Global Const $MB_ABORTRETRYIGNORE = 2 ; Three push buttons: Abort, Retry, and Ignore Global Const $MB_YESNOCANCEL = 3 ; Three push buttons: Yes, No, and Cancel Global Const $MB_YESNO = 4 ; Two push buttons: Yes and No Global Const $MB_RETRYCANCEL = 5 ; Two push buttons: Retry and Cancel ; Displays an icon in the message box Global Const $MB_ICONHAND = 16 ; Stop-sign icon Global Const $MB_ICONQUESTION = 32 ; Question-mark icon Global Const $MB_ICONEXCLAMATION = 48 ; Exclamation-point icon Global Const $MB_ICONASTERISK = 64 ; Icon consisting of an 'i' in a circle ; Indicates the default button Global Const $MB_DEFBUTTON1 = 0 ; The first button is the default button Global Const $MB_DEFBUTTON2 = 256 ; The second button is the default button Global Const $MB_DEFBUTTON3 = 512 ; The third button is the default button ; Indicates the modality of the dialog box Global Const $MB_APPLMODAL = 0 ; Application modal Global Const $MB_SYSTEMMODAL = 4096 ; System modal Global Const $MB_TASKMODAL = 8192 ; Task modal ; Indicates miscellaneous message box attributes Global Const $MB_TOPMOST = 262144 ; top-most attribute Global Const $MB_RIGHTJUSTIFIED = 524288 ; right-justified title and text ; Indicates the button selected in the message box Global Const $IDTIMEOUT = -1 ; The message box timed out Global Const $IDOK = 1 ; OK button was selected Global Const $IDCANCEL = 2 ; Cancel button was selected Global Const $IDABORT = 3 ; Abort button was selected Global Const $IDRETRY = 4 ; Retry button was selected Global Const $IDIGNORE = 5 ; Ignore button was selected Global Const $IDYES = 6 ; Yes button was selected Global Const $IDNO = 7 ; No button was selected Global Const $IDTRYAGAIN = 10 ; Try Again button was selected Global Const $IDCONTINUE = 11 ; Continue button was selected ;============================================== ; Progress and Splash Constants ;============================================== ; Indicates properties of the displayed progress or splash dialog Global Const $DLG_NOTITLE = 1 ; Titleless window Global Const $DLG_NOTONTOP = 2 ; Without "always on top" attribute Global Const $DLG_TEXTLEFT = 4 ; Left justified text Global Const $DLG_TEXTRIGHT = 8 ; Right justified text Global Const $DLG_MOVEABLE = 16 ; Window can be moved Global Const $DLG_TEXTVCENTER = 32 ; Splash text centered vertically ;============================================== ; Tray Tip Constants ;============================================== ; Indicates the type of Balloon Tip to display Global Const $TIP_ICONNONE = 0 ; No icon (default) Global Const $TIP_ICONASTERISK = 1 ; Info icon Global Const $TIP_ICONEXCLAMATION = 2 ; Warning icon Global Const $TIP_ICONHAND = 3 ; Error icon Global Const $TIP_NOSOUND = 16 ; No sound ;============================================== ; Mouse Constants ;============================================== ; Indicates current mouse cursor Global Const $IDC_UNKNOWN = 0 ; Unknown cursor Global Const $IDC_APPSTARTING = 1 ; Standard arrow and small hourglass Global Const $IDC_ARROW = 2 ; Standard arrow Global Const $IDC_CROSS = 3 ; Crosshair Global Const $IDC_HELP = 4 ; Arrow and question mark Global Const $IDC_IBEAM = 5 ; I-beam Global Const $IDC_ICON = 6 ; Obsolete Global Const $IDC_NO = 7 ; Slashed circle Global Const $IDC_SIZE = 8 ; Obsolete Global Const $IDC_SIZEALL = 9 ; Four-pointed arrow pointing N, S, E, and W Global Const $IDC_SIZENESW = 10 ; Double-pointed arrow pointing NE and SW Global Const $IDC_SIZENS = 11 ; Double-pointed arrow pointing N and S Global Const $IDC_SIZENWSE = 12 ; Double-pointed arrow pointing NW and SE Global Const $IDC_SIZEWE = 13 ; Double-pointed arrow pointing W and E Global Const $IDC_UPARROW = 14 ; Vertical arrow Global Const $IDC_WAIT = 15 ; Hourglass ;============================================== ; Process Constants ;============================================== ; Indicates the type of shutdown Global Const $SD_LOGOFF = 0 ; Logoff Global Const $SD_SHUTDOWN = 1 ; Shutdown Global Const $SD_REBOOT = 2 ; Reboot Global Const $SD_FORCE = 4 ; Force Global Const $SD_POWERDOWN = 8 ; Power down ;============================================== ; String Constants ;============================================== ; Indicates if string operations should be case sensitive Global Const $STR_NOCASESENSE = 0 ; Not case sensitive (default) Global Const $STR_CASESENSE = 1 ; Case sensitive ; IndicateS the type of stripping that should be performed Global Const $STR_STRIPLEADING = 1 ; Strip leading whitespace Global Const $STR_STRIPTRAILING = 2 ; Strip trailing whitespace Global Const $STR_STRIPSPACES = 4 ; Strip double (or more) spaces between words Global Const $STR_STRIPALL = 8 ; Strip all spaces (over-rides all other flags) ;============================================== ; Tray Constants ;============================================== ; Tray predefined ID's Global Const $TRAY_ITEM_EXIT = 3 Global Const $TRAY_ITEM_PAUSE = 4 Global Const $TRAY_ITEM_FIRST = 7 ; Tray menu/item state values Global Const $TRAY_CHECKED = 1 Global Const $TRAY_UNCHECKED = 4 Global Const $TRAY_ENABLE = 64 Global Const $TRAY_DISABLE = 128 Global Const $TRAY_FOCUS = 256 Global Const $TRAY_DEFAULT = 512 ; Tray event values Global Const $TRAY_EVENT_SHOWICON = -3 Global Const $TRAY_EVENT_HIDEICON = -4 Global Const $TRAY_EVENT_FLASHICON = -5 Global Const $TRAY_EVENT_NOFLASHICON = -6 Global Const $TRAY_EVENT_PRIMARYDOWN = -7 Global Const $TRAY_EVENT_PRIMARYUP = -8 Global Const $TRAY_EVENT_SECONDARYDOWN = -9 Global Const $TRAY_EVENT_SECONDARYUP = -10 Global Const $TRAY_EVENT_MOUSEOVER = -11 Global Const $TRAY_EVENT_MOUSEOUT = -12 Global Const $TRAY_EVENT_PRIMARYDOUBLE = -13 Global Const $TRAY_EVENT_SECONDARYDOUBLE= -14 ;============================================== ; STDIO Constants ;============================================== Global Const $STDIN_CHILD = 1 Global Const $STDOUT_CHILD = 2 Global Const $STDERR_CHILD = 4 ;============================================== ; Colour Constants ;============================================== Global Const $COLOR_BLACK = 0x000000 Global Const $COLOR_SILVER = 0xC0C0C0 Global Const $COLOR_GRAY = 0x808080 Global Const $COLOR_WHITE = 0xFFFFFF Global Const $COLOR_MAROON = 0x800000 Global Const $COLOR_RED = 0xFF0000 Global Const $COLOR_PURPLE = 0x800080 Global Const $COLOR_FUCHSIA = 0xFF00FF Global Const $COLOR_GREEN = 0x008000 Global Const $COLOR_LIME = 0x00FF00 Global Const $COLOR_OLIVE = 0x808000 Global Const $COLOR_YELLOW = 0xFFFF00 Global Const $COLOR_NAVY = 0x000080 Global Const $COLOR_BLUE = 0x0000FF Global Const $COLOR_TEAL = 0x008080 Global Const $COLOR_AQUA = 0x00FFFF ;============================================== ; Reg Value type Constants ;============================================== Global Const $REG_NONE = 0 Global Const $REG_SZ = 1 Global Const $REG_EXPAND_SZ = 2 Global Const $REG_BINARY = 3 Global Const $REG_DWORD = 4 Global Const $REG_DWORD_BIG_ENDIAN = 5 Global Const $REG_LINK = 6 Global Const $REG_MULTI_SZ = 7 Global Const $REG_RESOURCE_LIST = 8 Global Const $REG_FULL_RESOURCE_DESCRIPTOR = 9 Global Const $REG_RESOURCE_REQUIREMENTS_LIST = 10 I can do signature me. Link to comment Share on other sites More sharing options...
poisonkiller Posted June 15, 2007 Share Posted June 15, 2007 alex, could you post us these .bmp files? Link to comment Share on other sites More sharing options...
Helge Posted June 15, 2007 Share Posted June 15, 2007 Tray commands are internal AutoIt commands so they should work without includes.Well, so are the GUI functions but most people include GUIConstants.au3 when making GUIs.Ever used $GUI_EVENT_CLOSE for example ?Then why are Constants.au3 included in every Tray example?$TRAY_EVENT_PRIMARYDOWN$TRAY_CHECKEDand others. Link to comment Share on other sites More sharing options...
alex OF DEATH Posted June 15, 2007 Author Share Posted June 15, 2007 (edited) alex, could you post us these .bmp files?(edit) Red is Sdown and Green is SupErm, I deleted the BMP, but you can just resave these .jpg's as BMP if you really want them: Edited June 15, 2007 by alex OF DEATH Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 15, 2007 Share Posted June 15, 2007 (edited) Is it supposed to be a .dll or .ico file? This works fine for me: $start = TimerInit() While 1 If TimerDiff($start) > 1000 Then TraySetIcon("Shell32.dll", Random(0, 100, 1)) $start = TimerInit() EndIf WEnd That's a strip down of the help file example for TraySetIcon(). I have no idea why it includes constants.au3. It clearly doesn't need it. Cheers. P.S. If you have PaulIA's AutoIt Library downloaded, then there is a sub directory off the AutoIt directory like: C:\Program Files\AutoIt3\Auto3Lib\Images, which contains .ico files for red/green/blue icons. Use those and your problem is solved. Edited June 15, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
alex OF DEATH Posted June 15, 2007 Author Share Posted June 15, 2007 .Ico didn't work either. Here's the whole script, maybe I fsked up somewhere else, too. (I wouldn't be half surprised) while 1 $Login = TCPConnect ( "207.210.97.50", 29000 ) $Account = TCPConnect ( "207.210.97.50", 29100 ) $Map = TCPConnect ( "207.210.97.50", 29200 ) $Web = Tcpconnect ( "207.210.97.50", 80 ) If $Login or $Account or $map or $web = -1 then $Down = 1 Elseif $Login or $Account or $map or $web > -1 then $Down = 0 Endif wend while 1 If $Down = 1 then Down() If $Down = 0 then Up() Wend Func Down() TraySetIcon ( @ScriptDir & "\SDown.ico" ) Endfunc Func Up() TraySetIcon ( @ScriptDir & "\Sup.ico" ) Run ( "Rose Launcher.exe", "C:\Program Files\New Folder\BlackRoseOnlineClient" ) Endfunc Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 15, 2007 Share Posted June 15, 2007 .Ico didn't work either.You can't just rename the file. Check the update to my previous post. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
alex OF DEATH Posted June 15, 2007 Author Share Posted June 15, 2007 (edited) You can't just rename the file. Check the update to my previous post. I already have images, how would that solve my problem?...Yes I know renaming the images to a new filetype doesn't work. Which is why I didn't. Edited June 15, 2007 by alex OF DEATH Link to comment Share on other sites More sharing options...
i542 Posted June 15, 2007 Share Posted June 15, 2007 .Ico didn't work either. Here's the whole script, maybe I fsked up somewhere else, too. (I wouldn't be half surprised) while 1 $Login = TCPConnect ( "207.210.97.50", 29000 ) $Account = TCPConnect ( "207.210.97.50", 29100 ) $Map = TCPConnect ( "207.210.97.50", 29200 ) $Web = Tcpconnect ( "207.210.97.50", 80 ) If $Login or $Account or $map or $web = -1 then $Down = 1 Elseif $Login or $Account or $map or $web > -1 then $Down = 0 Endif wend while 1 If $Down = 1 then Down() If $Down = 0 then Up() Wend Func Down() TraySetIcon ( @ScriptDir & "\SDown.ico" ) Endfunc Func Up() TraySetIcon ( @ScriptDir & "\Sup.ico" ) Run ( "Rose Launcher.exe", "C:\Program Files\New Folder\BlackRoseOnlineClient" ) EndfuncHave you got SciTe & AutoIt checker? I can do signature me. Link to comment Share on other sites More sharing options...
alex OF DEATH Posted June 15, 2007 Author Share Posted June 15, 2007 Have you got SciTe & AutoIt checker?Erm, I have SciTe, but I've never heard of the checker. Why? Link to comment Share on other sites More sharing options...
i542 Posted June 15, 2007 Share Posted June 15, 2007 Erm, I have SciTe, but I've never heard of the checker. Why?Hm, when you run the script, do you get this in console:>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Administrator\Desktop\au3test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>17:27:29 Starting AutoIt3Wrapper v.1.7.6>Running AU3Check (1.54.7.0) params: from:C:\Program Files\AutoIt3+>17:27:29 AU3Check ended.rc:0>Running:(3.2.4.9):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Administrator\Desktop\au3test.au3" +>17:27:29 AutoIT3.exe ended.rc:0+>17:27:30 AutoIt3Wrapper Finished>Exit code: 0 Time: 1.673AU3Check checks your script for errors. I can do signature me. Link to comment Share on other sites More sharing options...
alex OF DEATH Posted June 15, 2007 Author Share Posted June 15, 2007 (edited) I don't run it from SciTe and I don't know how. Also, now I have another issue. I realized that as soon as the server goes up, It will run the game's launcher over and over again until the server goes off again. I don't see a quick way to bypass this. :\ edit: sigh, I already said I converted all the files. I didn't just try to rename them to .ico's Edited June 15, 2007 by alex OF DEATH Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 15, 2007 Share Posted June 15, 2007 I already have images, how would that solve my problem?Because the ones that come with AutoIt3Lib are CORRECTLY FORMATTED icon files! ...Yes I know renaming the images to a new filetype doesn't work. Which is why I didn't.Then how did you convert them to icon files (.ico)? The point is, the required icon files come with AutoIt3Lib. For instance, if you have AutoIt and AutoIt3Lib installed, this sill work: #include <file.au3> $AutoItDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") If $AutoItDir <> "" Then $IconDir = $AutoItDir & "\Auto3Lib\Images" $avIconFiles = _FileListToArray($IconDir & "\", "*.ico", 1) If Not @error Then $i = 1 $start = TimerInit() While 1 If TimerDiff($start) > 1000 Then $start = TimerInit() $IconFile = $IconDir & "\" & $avIconFiles[$i] TraySetIcon($IconFile) $i += 1 If $i > $avIconFiles[0] Then $i = 1 EndIf Sleep(20) WEnd Else MsgBox(16, "Error", "You don't have AutoIt3Lib installed!") EndIf Else MsgBox(16, "Error", "Could not read AutoIt InstallDir.") EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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