Jump to content

brokenbeforetime

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by brokenbeforetime

  1. Anyone know what language Autoit V3 was coded in? Im very curious and can't find an answer.
  2. If you want somthing like Autoit for Android check out Tasker
  3. Think I found a better way using TraySetOnEvent, main loop runs while still allowing tray items to function. If you need to do the same thing with a form and buttons instead of system tray, use GUICtrlSetOnEvent. Basicaly this lets you create GUI without useing While 1/Switch/case... Heres an example useing TraySetOnEvent: #include <GUIConstantsEx.au3> Opt("TrayOnEventMode", 1) ; Enable TrayOnEventMode Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Local $idExit = TrayCreateItem("Exit") ;creates tray item TrayItemSetOnEvent($idExit, "EXITButton") ;links tray item to func EXITButton While 1 Beep(500, 100) ; Main code/loop here, runs continually Sleep(2000) WEnd func EXITButton() ;this function runs when tray item is clicked Exit EndFunc
  4. Can anyone tell me why this code doesn't work? It wont run the EXITButton function when I click the system tray menu... It works with a form and a button but not a system tray menu... is it suppouse to? am I missing somthing? Thanks. #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Local $idExit = TrayCreateItem("Exit") GUICtrlSetOnEvent($idExit, "EXITButton") While 1 Sleep(1000) ; Sleep to reduce CPU usage WEnd func EXITButton() Exit EndFunc
  5. Awesome, I think thats gonna work. Thanks!
  6. From the example above.... If you run the following code you will notice it beeps every 3 seconds, but the menus items (cases) no longer work when you click them...is it possible to have the following script beep every 3 seconds and the menu items still function....thats what I'm trying to do... #NoTrayIcon #include <MsgBoxConstants.au3> #include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant. Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Example() Func Example() Local $iSettings = TrayCreateMenu("Settings") ; Create a tray menu sub menu with two sub items. Local $iDisplay = TrayCreateItem("Display", $iSettings) Local $iPrinter = TrayCreateItem("Printer", $iSettings) TrayCreateItem("") ; Create a separator line. Local $idAbout = TrayCreateItem("About") TrayCreateItem("") ; Create a separator line. Local $idExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Switch TrayGetMsg() Case $idAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable. MsgBox($MB_SYSTEMMODAL, "", "AutoIt tray menu example." & @CRLF & @CRLF & _ "Version: " & @AutoItVersion & @CRLF & _ "Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1)) ; Find the folder of a full path. Case $iDisplay, $iPrinter while 1 MsgBox(0,'this is my monitor loop','') WEnd Case $idExit ; Exit the loop. ExitLoop EndSwitch Beep(500, 50) sleep(3000) WEnd EndFunc ;==>Example
  7. That doesn't solve my problem. The monitor loop should always be running and i should be able to use the menu buttons while it is running. I know its hard to explain... I don't even know if it possible. I want the case loop to be within another loop that is constantly performing its action. So in the example you posted, I want the msg box to keep looping but when I click exit the program should exit. I am using two scripts, one for a system tray icon and menus and one to monitor idle time/CPU usage. I want to combine that into one script.
  8. Hi I'm new to Autoit and the fourm. I have made a script/program that turns the monitor off wen the PC has been idle for a given time and the CPU usage is also under a given percent. It works fine but I am using two scripts, one for a system tray icon with menus to change settings ect. and one to monitor idle time/CPU usage and turn the monitor off ect. So basically I have two loops running at one time, one for the GUI and one for the program's function. Is it possible to combine the two into one script/loop?... Here is an example of what I tried... func guiloop() Switch TrayGetMsg() Case $Exit EXIT EndSwitch endfunc Do $iIdleTime = _Timer_GetIdleTime() sleep (250) call("guiloop") Until $iIdleTime > $sMinutes This almost seem to work, the loop runs and the menus seem to function except the code for the case doesn't run. when I access the menu the loop pauses and continues after I click a menu item, but the code attached to the item doesn't run. I hope I'm explaining myself well enough, I realize this is just a simple example but my full script is over 1500 lines and like I said I'm pretty new to Autoit so its kind of a mess right now. Any advice will be GREATLY appreciated, even if you just let me know if this would be possible or have any ideas at all... I really want to get this working as one script. Thanks.
×
×
  • Create New...