Leaderboard
Popular Content
Showing content with the highest reputation on 03/24/2015 in all areas
-
Global Pause, and general pause functions.
guestscripter reacted to JohnOne for a topic
I've made a makeshift universal pause function hack, which works by an external script controlling AutoIt's tray pause capability. Here's how it works,,, You Include the GlobalPause.au3 in your script, when you do that and run your script, it writes Pause.au3 to your script folder. Pause.au3 is the binary string which you see in GlobalPause.au3, it's just much neater to write it this way, The actual code of Pause.au3 is below. Your script (shown below as TestingPause.au3) needs everything you see in it except the Sleep and ConsoleWrite which is just there for demonstration purposes. It's pretty self explanatory really, you hit pause key and it should pause your script immediately, you press it again and it will resume it as though you hit the pause button in the system tray. That is all it is, automating that button and a bit of logic, the reason is just convenience and I've seen many people wanting a boil in the bag pause function. Most of the automation code comes from M32 / rover in >this post, or one similar to it (cannot quite remember, I found a few), with a few adjustments. Here is the setback, your script's system tray icon must be visible in the tray and not hidden, I simply cannot find a way to automate the hidden ones. You can make it stay there by using the customize icon link in the hidden tray. The Code The Include: GlobalPause.au3 The test script: TestingPause.au3 The code which the included binary resolves to: Pause.au3 It's trivial to get all this working with your compiled scripts, or have the Pause.au3 compiled, in fact that's how I started it, but then thought about non compiled scripts and changed it. Probably mostly just help noob botters, but I hope someone at least gets some use from it, basically just saves you writing your embedded pause function. And this probably won't even work on a machine other than my own. EDIT: This thread now includes other more general Pause implementations. >General pause function for hot key. >General pause function for gui button. >Classic MsgBox pause. >Pause via Tray Menu. Please feel free to add any other pause implementations. The Zip for global pause: GlobalPause.zip1 point -
Then try this: ; PNG work around by Zedna #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global Const $SC_DRAGMOVE = 0xF012 ; Create GUI Global $g_hGUI = GUICreate("Show PNG", 512, 512, -1, -1, $WS_POPUP, $WS_EX_LAYERED) Global $g_hGUI_Child = GUICreate("", 512, 512, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $g_hGUI) GUISetBkColor(0x888888, $g_hGUI_Child) Global $iLabel = GUICtrlCreateLabel("", 200, 200, 112, 32, BitOR($SS_CENTERIMAGE, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial", 6) GUICtrlSetColor(-1, 0xF0F0F0) GUICtrlSetBkColor(-1, 0x404040) GUISetState(@SW_SHOW, $g_hGUI) GUISetState(@SW_SHOW, $g_hGUI_Child) _WinAPI_SetLayeredWindowAttributes($g_hGUI_Child, 0x888888) ; Load PNG image _GDIPlus_Startup() Global $g_hImage = _GDIPlus_ImageLoadFromFile("logo.png") ;~ Global $g_hImage = _GDIPlus_BitmapCreateFromMemory(InetRead("http://www.hooddonz.com/uploads/3/4/9/0/3490457/3227883.png")) Global $g_hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($g_hImage) _WinAPI_UpdateLayeredWindowEx($g_hGUI, -1, -1, $g_hGDIBitmap, 255, True) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") AdlibRegister("Timer", 1000) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd AdlibUnRegister("Timer") ; Clean up resources _GDIPlus_ImageDispose($g_hImage) _WinAPI_DeleteObject($g_hGDIBitmap) _GDIPlus_Shutdown() GUIDelete() Func Timer() GUICtrlSetData($iLabel, @SEC) EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($g_hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN1 point
-
trying some simple clicks not work? (noob)
SorryButImaNewbie reacted to JLogan3o13 for a topic
pdark1987, what kind of document are you trying to manipulate? I can almost guarantee there is an easier way than using Mouseclicks, which will only lead to headache1 point -
You could set a bookmark when closing the document and return to this bookmark when you open the document.1 point
-
Do a google search for vbs word and 'trackchanges'...example vbs to loop through changes (you must have tracking turned on): With ActiveDocument.Content.Revisions If Selection.Range = .Item(.Count).Range Then 'MsgBox "Last one" - for test only Exit Do End If End With it can be converted to autoit.1 point
-
The forum has been upgraded to IPB 3.4.7 which is just backend exploit/security fixes so there shouldn't be any visible changes that I know of. I've also fixed a number of database issues that would prevent a future upgrade to IPB 4 which is currently in the release candidate stage. Basically, the collation type of this forum was using utf_general_ci and IPB 4 will enforce utf8_unicode_ci. Not a major difference but there were inconsistencies in database, table and column types in many places that needed fixing. When this forum was first created (IPB 1.2!) it was in latin1 and over the years it's gone through various upgrades and transitions to utf8 - I've just made sure everything is clean ready for any future upgrades. I'll be installing the release candidate of IPB 4 as a test forum on this site. I'll probably need help testing (especially the nightmare that will be getting autoit code tags working) so watch out for posts in the dev forum about that.1 point
-
BetaLeaf, I have amended a few words in the title and text of your OP - please do not change them back. M231 point
-
Here is an example that shows the potential of this method. A virtual listview is filled with 10 columns and 10000/50000/100000 rows. All items are drawn with a random background color. I think it's pretty impressive. #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiTab.au3> Opt( "MustDeclareVars", 1 ) Global $hGui, $hLV, $aItems[100000][10], $aColors[100000][10], $iRows Global $tText = DllStructCreate( "wchar[100]" ) Example() Func Example() ; Create GUI $hGui = GUICreate( "Virtual listview", 850, 400 ) ; Create Tab Local $idTab = GUICtrlCreateTab( 10, 10, 850-20, 400-20 ) GUICtrlCreateTabItem( "10000 rows" ) GUICtrlCreateTabItem( "50000 rows" ) GUICtrlCreateTabItem( "100000 rows" ) GUICtrlCreateTabItem( "" ) ; Create ListView Local $idLV = GUICtrlCreateListView( "", 20, 40, 850-40, 400-60, $LVS_OWNERDATA, BitOR( $WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT ) ) $hLV = GUICtrlGetHandle ( $idLV ) For $i = 0 To 9 _GUICtrlListView_AddColumn( $hLV, "Col" & $i, 75 ) Next GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) GUISetState( @SW_SHOW ) $iRows = 10000 FillArray( $iRows ) FillColors( $iRows ) GUICtrlSendMsg( $idLV, $LVM_SETITEMCOUNT, $iRows, 0 ) ; Message loop While 1 Switch GUIGetMsg() Case $idTab Switch GUICtrlRead( $idTab ) Case 0 $iRows = 10000 Case 1 $iRows = 50000 Case 2 $iRows = 100000 EndSwitch FillArray( $iRows ) FillColors( $iRows ) GUICtrlSendMsg( $idLV, $LVM_SETITEMCOUNT, $iRows, 0 ) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc Func FillArray( $iRows ) For $i = 0 To $iRows - 1 If Not Mod( $i, 10000 ) Then _ WinSetTitle( $hGui, "", "Virtual listview. Fills arrays: " & $i & " rows" ) For $j = 0 To 9 $aItems[$i][$j] = $i & "|" & $j Next Next If Not Mod( $i, 10000 ) Then _ WinSetTitle( $hGui, "", "Virtual listview: " & $i & " rows" ) EndFunc Func FillColors( $iRows ) Local $aItemCols = [ 0xCCCCFF, 0xCCFFFF, 0xCCFFCC, 0xFFFFCC, 0xFFCCCC, 0xFFCCFF ] ; BGR For $i = 0 To $iRows - 1 If Not Mod( $i, 10000 ) Then _ WinSetTitle( $hGui, "", "Virtual listview. Fills arrays: " & $iRows & " rows and " & $i & " colors" ) For $j = 0 To 9 $aColors[$i][$j] = $aItemCols[Random(0,5,1)] Next Next If Not Mod( $i, 10000 ) Then _ WinSetTitle( $hGui, "", "Virtual listview: " & $iRows & " rows and " & $i & " colors" ) EndFunc Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) $hWndFrom = HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) $iCode = DllStructGetData( $tNMHDR, "Code" ) Switch $hWndFrom Case $hLV Switch $iCode Case $LVN_GETDISPINFOW ; Fill virtual listview Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam ) If BitAND( DllStructGetData( $tNMLVDISPINFO, "Mask" ), $LVIF_TEXT ) Then Local $sItem = $aItems[DllStructGetData($tNMLVDISPINFO,"Item")][DllStructGetData($tNMLVDISPINFO, "SubItem")] DllStructSetData( $tText, 1, $sItem ) DllStructSetData( $tNMLVDISPINFO, "TextMax", StringLen( $sItem ) ) DllStructSetData( $tNMLVDISPINFO, "Text", DllStructGetPtr( $tText ) ) EndIf Case $NM_CUSTOMDRAW Local $tNMLVCUSTOMDRAW = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $dwDrawStage = DllStructGetData($tNMLVCUSTOMDRAW, "dwDrawStage") Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins Return $CDRF_NOTIFYITEMDRAW ; Notify the parent window of any item-related drawing operations Case $CDDS_ITEMPREPAINT ; Before painting an item Return $CDRF_NOTIFYSUBITEMDRAW ; Notify the parent window of any subitem-related drawing operations Case BitOR( $CDDS_ITEMPREPAINT, $CDDS_SUBITEM ) ; Before painting a subitem ;Local $iItem = DllStructGetData($tNMLVCUSTOMDRAW, "dwItemSpec") ; Item index ;Local $iSubItem = DllStructGetData($tNMLVCUSTOMDRAW, "iSubItem") ; Subitem index ;DllStructSetData( $tNMLVCUSTOMDRAW, "ClrTextBk", $aColors[$iItem][$iSubItem] ) ; Backcolor of item/subitem DllStructSetData( $tNMLVCUSTOMDRAW, "ClrTextBk", $aColors[DllStructGetData($tNMLVCUSTOMDRAW, "dwItemSpec")][DllStructGetData($tNMLVCUSTOMDRAW, "iSubItem")] ) Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc1 point
-
want to know how to replicate this Gui
VenusProject2 reacted to Melba23 for a topic
damian666, I would do it using child GUIS like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTab.au3> $hGUI = GUICreate("Test", 500, 500) $cTab = GUICtrlCreateTab(10, 10, 480, 300) $cTabItem_0 = GUICtrlCreateTabItem("Tab 0") $cTabItem_1 = GUICtrlCreateTabItem("Tab 1") $cTabItem_2 = GUICtrlCreateTabItem("Tab 2") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $hGUI) ; Get tab position $aTab_Pos = ControlGetPos($hGUI, "", $cTab) ; Get size of user area $aTab_Rect = _GUICtrlTab_GetItemRect($cTab, 0) ; Create Child GUIs $hChild_0 = GUICreate("Child 0", $aTab_Pos[2] - 6, $aTab_Pos[3] - $aTab_Rect[3] - 6, $aTab_Pos[0] + 2, $aTab_Pos[1] + $aTab_Rect[3] + 2, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUICtrlCreateMenu("Menu 00") GUICtrlCreateMenu("Menu 01") GUICtrlCreateMenu("Menu 02") $aClient = WinGetClientSize($hChild_0) GUICtrlCreateListView("Col 00|Col 01|Col 02", 10, 10, $aClient[0] - 20, $aClient[1] - 20) GUISetState(@SW_SHOW, $hChild_0) GUISetBkColor(0xFFCCCC, $hChild_0) $hChild_1 = GUICreate("Child 1", $aTab_Pos[2] - 6, $aTab_Pos[3] - $aTab_Rect[3] - 6, $aTab_Pos[0] + 2, $aTab_Pos[1] + $aTab_Rect[3] + 2, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUICtrlCreateMenu("Menu 10") GUICtrlCreateMenu("Menu 21") GUICtrlCreateMenu("Menu 32") GUICtrlCreateListView("Col 10|Col 11|Col 12", 10, 10, $aClient[0] - 20, $aClient[1] - 20) GUISetBkColor(0xCCFFCC, $hChild_1) GUISetState(@SW_HIDE, $hChild_1) $hChild_2 = GUICreate("Child 2", $aTab_Pos[2] - 6, $aTab_Pos[3] - $aTab_Rect[3] - 6, $aTab_Pos[0] + 2, $aTab_Pos[1] + $aTab_Rect[3] + 2, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUICtrlCreateMenu("Menu 20") GUICtrlCreateMenu("Menu 21") GUICtrlCreateMenu("Menu 22") GUICtrlCreateListView("Col 20|Col 21|Col 20", 10, 10, $aClient[0] - 20, $aClient[1] - 20) GUISetBkColor(0xCCCCFF, $hChild_2) GUISetState(@SW_HIDE, $hChild_2) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cTab Switch GUICtrlRead($cTab) Case 0 _HideAll() GUISetState(@SW_SHOW, $hChild_0) Case 1 _HideAll() GUISetState(@SW_SHOW, $hChild_1) Case 2 _HideAll() GUISetState(@SW_SHOW, $hChild_2) EndSwitch EndSwitch WEnd Func _HideAll() GUISetState(@SW_HIDE, $hChild_0) GUISetState(@SW_HIDE, $hChild_1) GUISetState(@SW_HIDE, $hChild_2) EndFunc Please ask if you have any questions. M231 point -
A recent thread degenerated into personal abuse because some members posted rather sarcasticly in response to the initial question and the OP then responded with rather more venom than was probably warranted. Can I take this opportunity to remind people that we try to run a civilised and polite forum and we would appreciate it if you could act accordingly. If you do not have a sensible comment to make in response to a question, please refrain from posting at all. And, as is explained in the Forum rules, if you do get flamed just report the offending post to the moderating team so that we can deal with it. Certainly do not expect us to take sides if you engage in a flame war - all participants will be treated as equally guilty. Basically, please help us keep the forum running in the way the majority of members would like to see. Thanks in advance for your cooperation. M231 point