satanttin Posted July 21, 2014 Share Posted July 21, 2014 Hello, What i am trying to do is making a script that holds test scripts so i can easily find specific snippets for when i need it. So first step is figure out how to add the .au3 scripts in the scriptdir in a traymenu. problem is i don't know if it is possible to do and how to begin. So hope someone can tell me where to start looking and maybe tell me what function it is that i need to use. I use oneventmode since that's the only way i can script :') Thanks in advance. Link to comment Share on other sites More sharing options...
careca Posted July 21, 2014 Share Posted July 21, 2014 (edited) Hi, had this base script, made some changes, it's very preliminar, see how it works for you. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Icon=.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=By: ;#AutoIt3Wrapper_Res_Description= #AutoIt3Wrapper_Res_Fileversion=1.0 #AutoIt3Wrapper_Res_SaveSource=y ;#AutoIt3Wrapper_Res_Icon_Add=.ico #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> #include <GUIConstantsEx.au3> Opt("TrayMenuMode", 1) Opt("TrayIconHide", 0) Opt("GUIResizeMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 0) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 1) Opt("ExpandEnvStrings", 1) Opt("WinDetectHiddenText", 1) ;Gui Local $GUI, $Frm_main, $Button_1 ;Tray Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem ;Vars Local $Au3filesArray, $Item TraySetIcon("ico.ico") $GUI = GUICreate('Au3', 150, 100, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") $ExitItem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Quit") $Button_1 = GUICtrlCreateButton("Search and add scripts", 10, 10) GUICtrlSetOnEvent($Button_1, "SrchAdd") GUISetState() TraySetState(1) TraySetClick(8) ;============================================================================= Do Sleep(15) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;============================================================================= Func SrchAdd() $Au3filesArray = _FileListToArray(@ScriptDir, '*.au3', 1, 0) For $i = 1 To $Au3filesArray[0] ConsoleWrite('$Au3filesArray[$i] ' & $Au3filesArray[$i] & @CRLF) $Au3filesArray[$i] = TrayCreateItem($Au3filesArray[$i]) TrayItemSetOnEvent($Au3filesArray[$i], $Au3filesArray[$i]) Next EndFunc ;==>SrchAdd ;============================================================================= Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit ;============================================================================= This got me thinking, now how do i click those? Edited July 21, 2014 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
satanttin Posted July 21, 2014 Author Share Posted July 21, 2014 Thanks for the script ^^ shall check it and let u know if it works :3 Link to comment Share on other sites More sharing options...
satanttin Posted July 21, 2014 Author Share Posted July 21, 2014 Woah so close O.o just have to adjust it a little bit don't want the gui so gonna make a tray button out of it. the only problem now is when i press a tray button it won't open the script mhmm Link to comment Share on other sites More sharing options...
careca Posted July 21, 2014 Share Posted July 21, 2014 (edited) Yup, working on it, not sure i will be able to figure it out, since the new tray items are in memory. EDIT: I think the best way to make this work, is by somehow detect in which item you click, retrieve the text, and use that to open the script. Edited July 21, 2014 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
satanttin Posted July 21, 2014 Author Share Posted July 21, 2014 ahh okay well atleast i got a good start thanks to you^^ now just figure out how to open them when i click them i shall post the full script when i find it ^^ Link to comment Share on other sites More sharing options...
Solution careca Posted July 21, 2014 Solution Share Posted July 21, 2014 (edited) This works for me, and should for you, assuming that your SciTe directory is the same as mine, if not, change it to the correct one. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Icon=.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=By: ;#AutoIt3Wrapper_Res_Description= #AutoIt3Wrapper_Res_Fileversion=1.0 #AutoIt3Wrapper_Res_SaveSource=y ;#AutoIt3Wrapper_Res_Icon_Add=.ico #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> #include <GUIConstantsEx.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayIconHide", 0) Opt("GUIResizeMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 0) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 0) Opt("ExpandEnvStrings", 1) Opt("WinDetectHiddenText", 1) ;Gui Local $GUI, $Frm_main, $Button_1 ;Tray Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem ;Vars Local $Au3filesArray, $Item, $State, $Msg, $GuiMsg, $CursorInfo, $txt TraySetIcon("ico.ico") $GUI = GUICreate('Au3', 150, 100, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") $ExitItem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Quit") $Button_1 = GUICtrlCreateButton("Search and add scripts", 10, 10) GUICtrlSetOnEvent($Button_1, "SrchAdd") GUISetState() TraySetState(1) TraySetClick(8) ;============================================================================= Do $Msg = TrayGetMsg() If $Msg > 0 Then $txt = TrayItemGetText($Msg) ConsoleWrite('$txt ' & $txt & @CRLF) If $txt = 'Close' Then Quit() ConsoleWrite(@ScriptDir & '\' & $txt & @CRLF) Run("C:\Program Files (x86)\AutoIt3\SciTE\SciTE.exe " & @ScriptDir & '\' & $txt) EndIf Sleep(50) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;============================================================================= Func SrchAdd() $Au3filesArray = _FileListToArray(@ScriptDir & '\', '*.au3', 1, 0) ConsoleWrite('$Au3filesArray[1] ' & $Au3filesArray[1] & @CRLF) ConsoleWrite('$Au3filesArray[2] ' & $Au3filesArray[2] & @CRLF) For $i = 1 To $Au3filesArray[0] $Au3filesArray[$i] = TrayCreateItem($Au3filesArray[$i]) TrayItemSetOnEvent($Au3filesArray[$i], $Au3filesArray[$i]) Next EndFunc ;==>SrchAdd ;============================================================================= Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit ;============================================================================= Edited July 21, 2014 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
satanttin Posted July 21, 2014 Author Share Posted July 21, 2014 Thank you, thank you very much Link to comment Share on other sites More sharing options...
careca Posted July 21, 2014 Share Posted July 21, 2014 If you find it useful, i made it so it reads the SciTe directory from registry, so it's all automatic. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Icon=.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=By: ;#AutoIt3Wrapper_Res_Description= #AutoIt3Wrapper_Res_Fileversion=1.0 #AutoIt3Wrapper_Res_SaveSource=y ;#AutoIt3Wrapper_Res_Icon_Add=.ico #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> #include <GUIConstantsEx.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayIconHide", 0) Opt("GUIResizeMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 0) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 0) Opt("ExpandEnvStrings", 1) Opt("WinDetectHiddenText", 1) ;Gui Local $GUI, $Frm_main, $Button_1 ;Tray Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem ;Vars Local $Au3filesArray, $Msg, $txt, $Reg, $RegTrim TraySetIcon("ico.ico") $GUI = GUICreate('Au3', 150, 100, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") $ExitItem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Quit") $Button_1 = GUICtrlCreateButton("Search and add scripts", 10, 10) GUICtrlSetOnEvent($Button_1, "SrchAdd") GUISetState() TraySetState(1) TraySetClick(8) $Reg = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoIt3Script\Shell\Edit\Command', '') $RegTrim = StringTrimRight($Reg, 5) ;============================================================================= Do $Msg = TrayGetMsg() If $Msg > 0 Then $txt = TrayItemGetText($Msg) If $txt = 'Close' Then Quit() Run($RegTrim & ' ' & @ScriptDir & '\' & $txt) EndIf Sleep(50) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;============================================================================= Func SrchAdd() $Au3filesArray = _FileListToArray(@ScriptDir & '\', '*.au3', 1, 0) ConsoleWrite('$Au3filesArray[1] ' & $Au3filesArray[1] & @CRLF) ConsoleWrite('$Au3filesArray[2] ' & $Au3filesArray[2] & @CRLF) For $i = 1 To $Au3filesArray[0] $Au3filesArray[$i] = TrayCreateItem($Au3filesArray[$i]) TrayItemSetOnEvent($Au3filesArray[$i], $Au3filesArray[$i]) Next EndFunc ;==>SrchAdd ;============================================================================= Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit ;============================================================================= Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
satanttin Posted July 21, 2014 Author Share Posted July 21, 2014 Only problem is btw that my snippets need to be in the @scriptDir and in a map named folderO.o is that also the problem that u have or am i missing something here? Link to comment Share on other sites More sharing options...
satanttin Posted July 21, 2014 Author Share Posted July 21, 2014 Got it working how i want now expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Icon=.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=By: ;#AutoIt3Wrapper_Res_Description= #AutoIt3Wrapper_Res_Fileversion=1.0 #AutoIt3Wrapper_Res_SaveSource=y ;#AutoIt3Wrapper_Res_Icon_Add=.ico #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> #include <GUIConstantsEx.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayIconHide", 0) Opt("GUIResizeMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 0) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 0) Opt("ExpandEnvStrings", 1) Opt("WinDetectHiddenText", 1) ;Gui Local $GUI, $Frm_main, $Button_1 ;Tray Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem ;Vars Local $Au3filesArray, $Item, $State, $Msg, $GuiMsg, $CursorInfo, $txt TraySetIcon("ico.ico") $GUI = GUICreate('Au3', 150, 100, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") $ExitItem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Quit") $Button_1 = GUICtrlCreateButton("Search and add scripts", 10, 10) GUICtrlSetOnEvent($Button_1, "SrchAdd") GUISetState() TraySetState(1) TraySetClick(8) ;============================================================================= Do $Msg = TrayGetMsg() If $Msg > 0 Then $txt = TrayItemGetText($Msg) ConsoleWrite('$txt ' & $txt & @CRLF) If $txt = 'Close' Then Quit() ConsoleWrite(@ScriptDir & '\' & $txt & @CRLF) Run("C:\Program Files (x86)\AutoIt3\SciTE\SciTE.exe " & @ScriptDir & '\' & "Snippets" & '\' & $txt) EndIf Sleep(50) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;============================================================================= Func SrchAdd() $Au3filesArray = _FileListToArray(@ScriptDir & '\'& "Snippets" & '\', '*.au3', 1, 0) ConsoleWrite('$Au3filesArray[1] ' & $Au3filesArray[1] & @CRLF) For $i = 1 To $Au3filesArray[0] $Au3filesArray[$i] = TrayCreateItem($Au3filesArray[$i]) TrayItemSetOnEvent($Au3filesArray[$i], $Au3filesArray[$i]) Next EndFunc ;==>SrchAdd ;============================================================================= Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit ;============================================================================= So how it works u got this script and u got a map named Snippets and just put the scripts in that map and run the script refresh the data and click away hope u like how i made a little change ^^ Link to comment Share on other sites More sharing options...
careca Posted July 21, 2014 Share Posted July 21, 2014 Great job. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe 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