Leaderboard
Popular Content
Showing content with the highest reputation on 08/12/2018 in all areas
-
gbrao, I have used something like this in the past: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <TrayConstants.au3> Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown. TrayCreateItem("Tray Item") TrayItemSetOnEvent(-1, "_TrayItem") TrayCreateItem("") TrayCreateItem("Tray Exit") TrayItemSetOnEvent(-1, "_Exit") TraySetState() ; Only left click will display tray menu TraySetClick(8) ; Set right click to display user GUI menu TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "_UserMenu") ; Create and hide user menu GUI $hUser_GUI = GUICreate("User Menu", 200, 200, -1, -1, $WS_POPUP) $cUser_Item = GUICtrlCreateLabel("User Item", 10, 10, 180, 20) $cUser_Close = GUICtrlCreateLabel("User Close", 10, 30, 180, 20) $cUser_Exit = GUICtrlCreateLabel("User Exit", 10, 50, 180, 20) GUISetState(@SW_HIDE) While 1 Switch GUIGetMsg() Case $cUser_Item ; Hide user menu GUISetState(@SW_HIDE) MsgBox($MB_SYSTEMMODAL, "User Item", "Clicked") Case $cUser_Close ; Hide user menu GUISetState(@SW_HIDE) Case $cUser_Exit _Exit() EndSwitch WEnd Func _UserMenu() ; Get mouse position Local $aMousePos = MouseGetPos() ; Move user menu WinMove($hUser_GUI, "", $aMousePos[0] - 200, $aMousePos[1] - 200) ; Show user menu GUISetState(@SW_SHOW) EndFunc Func _TrayItem() MsgBox(0, "Tray Item", "Clicked") EndFunc Func _Exit() Exit EndFunc Obviously the user menu GUI needs to be "prettified" but the idea is there. M232 points
-
So my computer is connected to my wifi, and my phone is connected to my wifi...so I can ping my phone continually. When I leave, and my phone disconnects, the ping will return a failure, and I can have the same locally running script on my computer click the button. Then I'll start looping the ping until it succeeds in pinging the cell phone, and click the other button. I'm not sure if the IP is generated real time or not though, so it might change with each reconnect. You can get the IP by going to your wifi page, clicking on your home's wifi settings. It will display all the info including the IP. $myCellPhoneIP = "127.0.0.1" While True While Ping($myCellPhoneIP) Sleep(5000) WEnd ConsoleWrite("Failed to ping $myCellPhoneIP=[" & $myCellPhoneIP & "]" & @CRLF) ControlClick('yourwindow',"","your button") While Not Ping($myCellPhoneIP) Sleep(5000) WEnd ConsoleWrite("Able to ping $myCellPhoneIP=[" & $myCellPhoneIP & "]" & @CRLF) ControlClick('yourwindow',"","your button") WEnd If the IP does change (you can test by turning on and off your phones wifi), then you will have to google how to dynamically get the ips connected to your network, such as looping through an IP range that your local wifi uses. Edit: I know this isn't exactly what you asked for, you'll have to wait for someone else for your specific question, but this is a very simple way to do the same kind of functionality. Another route: I suppose you can then create a file on your phone whenever, which you can check for on your computer, inside that mapped drive. Then when you get home, you can delete the file, which your script can check for, and turn off your application. I'd stick with the pings, because then I wouldn't have to do manually add in a file, or manually delete a file, it would just work.2 points
-
Running AutoIt code from any web browser
Marc reacted to scintilla4evr for a topic
For some time I was wondering how to execute AutoIt code from a web browser. I made some solutions using IE.au3, but that's only one browser. Is there a way to execute AutoIt from ANY browser? There is one - custom protocols. So, I looked how to add one, and here it is - running AutoIt from any web browser. AutoIt Protocol Example (run install.au3 before!): 2+2 in a MsgBox Edit: you can't use this protocol in posts here, how sad Have fun!1 point -
Searching for some text in a chrome web page
MrDjBthu reacted to pixelsearch for a topic
Hi MrDjBthu. I did this often with Opera Browser but without using NotePad or any manual search. Let your script send Ctrl-a (select all), then Ctrl-c (copy to clipboard), finally $sPageContent = ClipGet() Now let the script search anything you want inside the variable $sPageContent1 point -
Thanks for the code ripdad, it works perfect! Some tips for others getting it to work that I had to google through. If you are like me and you have AutoIt setup to run scrips in x64 by default you need to make sure you force the script to run in x86 as the bass.dll doesn't support x64 scripts. Just make sure to add this line to the top of the bass audio script ripdad made: #AutoIt3Wrapper_UseX64=n Make sure in windows your recording device is working properly that you want to read. For my Realtek sound card normally you want to read the "Stereo Mix" recording device as this is mimicking whatever sound the sound card is outputting. It works great on my Windows 7 computer, but on my Windows 10 computer I could never get the "Stereo Mix" device to ever output sound (No sound from Stereo Mix). After some googling I found this option: VB Audio Cable Option. I installed the VB Audio Cable and now it works perfect, the VB Audio Cable recording device mimics the sound card output (VB Audio Cable Recording Device). If it doesn't work as written by ripdad my final piece of advice is to play around with the device number in the _BASS_Init & _BASS_RecordInit functions. You may need to change from -1 which pulls the default devices to something like 0 or 1 to listen to the proper recording device if you have multiple.1 point
-
double arraysort
Skysnake reacted to pixelsearch for a topic
Hi Ternal, For the record, I tested your function on... 10 rows. It worked fine, just a couple of things : * All the sort went descending instead of ascending, probably due to the line : If $ascending = Default Then $ascending = 1 But 1 means descending in _ArraySort(), not ascending. Anyway, no big deal. * If $counter > 0 Then ;at least 2 of the same ... EndIf Why this condition when $counter is always > 0 anywhere in the script ? So I kept what was inside the If... EndIf, deleting these 2 If... Endif lines. Here we go : #include <Array.au3> #include <MsgBoxConstants.au3> Global $aArray[10][2] = _ [[3, 33] , _ [4, 43] , _ [4, 41] , _ [1, 11] , _ [3, 31] , _ [2, 22] , _ [4, 44] , _ [3, 32] , _ [4, 42] , _ [2, 21]] _ArrayDisplay($aArray, "Before Sort") MsgBox($MB_SYSTEMMODAL, "Result", _ArraySort_Double($aArray)) Here are the results, after adding a couple of _ArrayDisplay in your function : The "Finished" _ArrayDisplay shows how your double sorting script worked fine, bravo. Hope you'll find a tester with an Array of thousand of lines, as your line If Mod( $x, 10000) is waiting to be executed. Good luck1 point -
There are several different ways to do this. Here's a link that give some possible solutions. https://stackoverflow.com/questions/19046812/multiple-count-for-multiple-conditions-in-one-query-mysql1 point
-
Seems the MCI script I posted earlier, refuses to work on some computers. I simplified the BASS script above that careca posted -- I hope it works for you. Tested on a Toshiba with Win7... BASS Audio Levels.zip1 point
-
Did you want to color whole line with same color use native GUICtrlCreateListView, GUICtrlCreateListViewItem and GUICtrlSetColor. With UDF created LV it is possible to color each subitem different: ;https://autoit.de/index.php/Thread/84279-Unterschiedliche-Textfarben-innerhalb-einer-ListView/?postID=674295#post674295 #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <array.au3> #include <ListViewConstants.au3> #include <StructureConstants.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> Global $iDllGDI = DllOpen("gdi32.dll") $aColBK = IniReadSection(@ScriptDir & "\lv_format.ini", "ColBKColor") _ArrayDelete($aColBK, 0) ;_ArrayDisplay($aColBK) $aRowBK = IniReadSection(@ScriptDir & "\lv_format.ini", "RowBKColor") _ArrayDelete($aRowBK, 0) ;_ArrayDisplay($aColBK) $aColText = IniReadSection(@ScriptDir & "\lv_format.ini", "ColTextColor") _ArrayDelete($aColText, 0) ;_ArrayDisplay($aColBK) $aRowText = IniReadSection(@ScriptDir & "\lv_format.ini", "RowTextColor") _ArrayDelete($aRowText, 0) ;_ArrayDisplay($aRowText) Global $bColorHeader = True ;wenn true werden auch die Spaltenüberschriften mit eingefärbt. $GUI = GUICreate("Listview Farbig", 1024, 300, 0, 0) ;<==== Breite geändert $cListView = GUICtrlCreateListView("", 2, 2, 1020, 294, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) ;<==== Breite geändert ;_GUICtrlListView_SetExtendedListViewStyle($cListView, $LVS_EX_FULLROWSELECT) ; BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) $hListView = GUICtrlGetHandle($cListView) For $i = 1 To 31 _GUICtrlListView_InsertColumn($hListView, $i - 1, $i, 25) _GUICtrlListView_SetColumnWidth($hListView, $i - 1, 32) ;<==== eingefügt für Spaltenbreite Next ;get handle to child SysHeader32 control of ListView Global $hHeader = HWnd(GUICtrlSendMsg($cListView, $LVM_GETHEADER, 0, 0)) ;Turn off theme for header DllCall("uxtheme.dll", "int", "SetWindowTheme", "hwnd", $hHeader, "wstr", "", "wstr", "") ; Get the font of the Header control (credit KaFu) Local $hDC = _WinAPI_GetDC($hHeader) Local $hFont = _SendMessage($hHeader, $WM_GETFONT) Local $hObject = _WinAPI_SelectObject($hDC, $hFont) Local $tLogFont = DllStructCreate($tagLOGFONT) _WinAPI_GetObject($hFont, DllStructGetSize($tLogFont), DllStructGetPtr($tLogFont)) _WinAPI_SelectObject($hDC, $hObject) _WinAPI_ReleaseDC($hHeader, $hDC) Local $iWeight = DllStructGetData($tLogFont, "Weight") ; Bold DllStructSetData($tLogFont, "Weight", BitOR($iWeight, $FW_BOLD)) $hHdrFont = _WinAPI_CreateFontIndirect($tLogFont) For $i = 0 To 21 ; alle Item/SubItem erstellen _GUICtrlListView_AddItem($hListView, "Item: " & $i, $i) For $j = 1 To 30 _GUICtrlListView_AddSubItem($hListView, $i, "Sub: " & $j, $j) Next Next If $bColorHeader Then $iCols = _GUICtrlListView_GetColumnCount($hListView) Global Const $tagNMCUSTOMDRAW = "struct;" & $tagNMHDR & ";dword dwDrawStage;handle hdc;" & $tagRECT & _ ";dword_ptr dwItemSpec;uint uItemState;lparam lItemlParam;endstruct" Global $aHdrData[$iCols][3] ;Headerdata erstellen wird beim einfärben benötigt For $i = 0 To $iCols - 1 $aHdrData[$i][0] = _GUICtrlListView_GetColumn($hListView, $i)[5] $iIndex = _ArraySearch($aColText, $i, 0, 0, 0, 0, 1, 0) If $iIndex <> -1 Then $aHdrData[$i][1] = RGB2BGR($aColText[$iIndex][1]) Else $aHdrData[$i][1] = 0x000000 EndIf $iIndex = _ArraySearch($aColBK, $i, 0, 0, 0, 0, 1, 0) If $iIndex <> -1 Then $aHdrData[$i][2] = RGB2BGR($aColBK[$iIndex][1]) Else $aHdrData[$i][2] = 0xEEEEFF EndIf Next EndIf GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While True $msg = GUIGetMsg() Switch $msg Case -3 ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hHeader If $bColorHeader Then ;ConsoleWrite('Header: ' & $iCode & @CRLF) Switch $iCode Case $NM_CUSTOMDRAW Local $tNMCustomDraw = DllStructCreate($tagNMCUSTOMDRAW, $lParam) Local $dwDrawStage = DllStructGetData($tNMCustomDraw, "dwDrawStage") Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins Return $CDRF_NOTIFYITEMDRAW ; Notify parent window of any item related drawing operations Case $CDDS_ITEMPREPAINT ; Before an item is drawn: Default painting (frames and background) Return $CDRF_NOTIFYPOSTPAINT ; Notify parent window of any post item related drawing operations Case $CDDS_ITEMPOSTPAINT ; After an item is drawn: Custom painting (item texts) Local $tRECT = DllStructCreate($tagRECT) Local $iIndex = DllStructGetData($tNMCustomDraw, "dwItemSpec") ; Item index Local $hDC = DllStructGetData($tNMCustomDraw, "hdc") ; Device context _WinAPI_SelectObject($hDC, $hHdrFont) ; Set text font _WinAPI_SetBkMode($hDC, $TRANSPARENT) ; Transparent background _WinAPI_SetTextColor($hDC, $aHdrData[$iIndex][1]) ; Set text colour ; Get header section size DllStructSetData($tRECT, 1, DllStructGetData($tNMCustomDraw, 6) + 1) DllStructSetData($tRECT, 2, DllStructGetData($tNMCustomDraw, 7)) DllStructSetData($tRECT, 3, DllStructGetData($tNMCustomDraw, 8) - 2) DllStructSetData($tRECT, 4, DllStructGetData($tNMCustomDraw, 9) - 2) ; Set and draw back colour Local $hBrush = _WinAPI_CreateSolidBrush($aHdrData[$iIndex][2]) _WinAPI_FillRect($hDC, $tRECT, $hBrush) ; Write text If $iIndex < _GUICtrlListView_GetColumnCount($cListView) Then _WinAPI_DrawText($hDC, $aHdrData[$iIndex][0], $tRECT, $DT_CENTER + $DT_VCENTER) EndIf Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch EndIf Case $hListView ;ConsoleWrite('Listview' & @CRLF) Switch $iCode Case $NM_CUSTOMDRAW Local $tNMCustomDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage, $iItem, $iSubitem, $hDC, $tRECT $iDrawStage = DllStructGetData($tNMCustomDraw, 'dwDrawStage') Switch $iDrawStage Case $CDDS_ITEMPREPAINT Return $CDRF_NOTIFYSUBITEMDRAW Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM) ; Item/SubItem das aktuell gezeichnet werden soll ermitteln $iItem = DllStructGetData($tNMCustomDraw, 'dwItemSpec') $iSubitem = DllStructGetData($tNMCustomDraw, 'iSubItem') Switch $iItem ; Zeilenwahl Case -1 ;kommt nicht vor ist aber notwendig, damit case else verwendet werden kann Case Else $iIndex = _ArraySearch($aRowBK, $iItem, 0, 0, 0, 0, 1, 0) If $iIndex = -1 Then ;nicht im Array für spezielle Zeilen also weiß DllStructSetData($tNMCustomDraw, 'clrTextBk', RGB2BGR(0xFFFFFF)) Else DllStructSetData($tNMCustomDraw, 'clrTextBk', RGB2BGR($aRowBK[$iIndex][1])) ;ConsoleWrite('Item '&$iItem&' BK: '&$aRowBK[$iIndex][1] & @CRLF) EndIf $iIndex = _ArraySearch($aRowText, $iItem, 0, 0, 0, 0, 1, 0) If $iIndex = -1 Then ;nicht im Array für spezielle Zeilen also schwarz DllStructSetData($tNMCustomDraw, 'clrText', RGB2BGR(0x000000)) Else DllStructSetData($tNMCustomDraw, 'clrText', RGB2BGR($aRowText[$iIndex][1])) ;ConsoleWrite('Item '&$iItem&' Text: '&$aRowText[$iIndex][1] & @CRLF) EndIf EndSwitch Switch $iSubitem Case -1 ;kommt nicht vor ist aber notwendig, damit case else verwendet werden kann Case Else $iIndex = _ArraySearch($aColBK, $iSubitem, 0, 0, 0, 0, 1, 0) If $iIndex <> -1 Then DllStructSetData($tNMCustomDraw, 'clrTextBk', RGB2BGR($aColBK[$iIndex][1])) ;ConsoleWrite('SubItem '&$iSubitem&' BK: '&$aColBK[$iIndex][1] & @CRLF) EndIf $iIndex = _ArraySearch($aColText, $iSubitem, 0, 0, 0, 0, 1, 0) If $iIndex <> -1 Then DllStructSetData($tNMCustomDraw, 'clrText', RGB2BGR($aColText[$iIndex][1])) ;ConsoleWrite('SubItem '&$iSubitem&' Text: '&$aColText[$iIndex][1] & @CRLF) EndIf EndSwitch Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func RGB2BGR($iColor) Local $sH = Hex($iColor, 6) Return '0x' & StringRight($sH, 2) & StringMid($sH, 3, 2) & StringLeft($sH, 2) EndFunc ;==>RGB2BGR The au3 and the ini is specialited for calendars, but with your own wm_notify you can change to your needs. LV_CustomRedraw.au3 lv_format.ini1 point
-
A note for SQLite users who wonder: the dev team of SQLite is in the process of offering windowing functions. They are part of the current draft release: http://www.sqlite.org/draft/releaselog/3_25_0.html But don't forget this is just draft, subject to changes.1 point
-
try: If @error Then ConsoleWrite('! ---> @error=' & @error & ' @extended=' & @extended & ' : SOME DESCRITION' & @CRLF) you can use Abbreviations called: iferrc1 point
-
URL Encoding
Colduction reacted to ProgAndy for a topic
I wrote some functions including UTF-8 conversion Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"") Local $nChar $sData="" For $i = 1 To $aData[0] ; ConsoleWrite($aData[$i] & @CRLF) $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar,2) EndSwitch Next Return $sData EndFunc Func _URIDecode($sData) ; Prog@ndy Local $aData = StringSplit(StringReplace($sData,"+"," ",0,1),"%") $sData = "" For $i = 2 To $aData[0] $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2) Next Return BinaryToString(StringToBinary($aData[1],1),4) EndFunc MsgBox(0, '', _URIDecode(_URIEncode("testäöü fv"))) Edit 2012: Fixed bug in _URIEncode, removed debug output1 point -
User Groups and Rights New Members - New members with that joined the forum within the last day. While in this group there are certain restrictions on the number of posts/PMs that can be made. This is to reduce the impact of spammers. After 24 hours members of this group will be promoted the Members group. Members - Members older than one day but with less than 20 posts. Standard access to the forum. Active Members - Members with more than 20 posts have additional rights No advertsSlightly more generous attachment and PM limitsAccess to the Chat forumAbility to upload files to the Downloads section MVPs - Members who are judged by the community to be helpful, who write and share useful code, who help the development of AutoIt. These users have the same rights as normal members but get a team icon, a little more attachment and PM space, and access to the MVP Chat forum section. Moderators - The forum police. This is not a democracy and each of the mods has their own distinct personality. They have the rights to edit posts, delete posts, ban users, delete users, IP ban, etc. Let the poster beware. Developers - A small group of users with access to the AutoIt source code and who have contributed significantly to the internal development of AutoIt. Some of them are also Moderators. Post Count and Rankings Ranks based on increasing post count are as follows: SeekerWayfarerAdventurerProdigyPolymathUniversalistThese titles are auto-generated and have no relation to actual skill level. Once you reach 300 posts you can change the title to whatever you like.1 point