Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/21/2018 in all areas

  1. @Danp2 I understand the issue; we are working to address it.
    2 points
  2. Danp2

    Single Button in Source

    $oButton = _IETagNameGetCollection($oIE, "button", 0) _IEAction($oButton, 'click')
    1 point
  3. This is REALLY not the way I would be doing this but whatever its all about learning I suppose Your issue is that you loaded the new pictures while the controls were shrunk I fixed that with a loop to resize them load the random picture and reshrink them I also added a way to stop the darn script while I was at it --Edit Oh I See you Set the hotkey to Stop it #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;Set Hot-Keys HotKeySet("s", "Stop") $random1 = Random(0, 9, 1) $random2 = Random(0, 9, 1) $random3 = Random(0, 9, 1) $Spin = False $Sleep = 50 $Height = 132 #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 492, 252, 181, 124) GUISetBkColor(0x000000) Global $Pic1 = GUICtrlCreatePic(@ScriptDir & "\Numbers\" & $random1 & ".jpg", 48, 16, 100, 132) Global $Pic2 = GUICtrlCreatePic(@ScriptDir & "\Numbers\" & $random2 & ".jpg", 184, 16, 100, 132) Global $Pic3 = GUICtrlCreatePic(@ScriptDir & "\Numbers\" & $random3 & ".jpg", 320, 16, 100, 132) Global $Button1 = GUICtrlCreateButton("Spin", 56, 184, 75, 25) Global $Button2 = GUICtrlCreateButton("Stop", 336, 184, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Opt("GUIOnEventMode", 1) GUICtrlSetOnEvent($Button2, Stop) $Spin = True Spin() EndSwitch WEnd Func Spin() Local $aPicCtrls[3] = [$Pic1, $Pic2, $Pic3] Local $aPicLeft[3] = [48, 184, 320] While $Spin = True For $i = 0 To UBound($aPicCtrls) - 1 For $a = 1 To 132 Step 10 GUICtrlSetPos($aPicCtrls[$i], $aPicLeft[$i], 16, 100, 132 - $a) Sleep($Sleep) If Not $Spin Then ExitLoop 3 Next Next For $i = 0 To UBound($aPicCtrls) - 1 $iRand = Random(0, 9, 1) GUICtrlSetState($aPicCtrls[$i], $GUI_HIDE) GUICtrlSetPos($aPicCtrls[$i], $aPicLeft[$i], 16, 100, 132) GUICtrlSetImage($aPicCtrls[$i], @ScriptDir & "\Numbers\" & $iRand & ".jpg") GUICtrlSetPos($aPicCtrls[$i], $aPicLeft[$i], 16, 100, 0) GUICtrlSetState($aPicCtrls[$i], $GUI_SHOW) Next For $i = 0 To UBound($aPicCtrls) - 1 For $a = 1 To 132 Step 10 GUICtrlSetPos($aPicCtrls[$i], $aPicLeft[$i], 16, 100, 2 + $a) Sleep($Sleep) If Not $Spin Then ExitLoop 3 Next Next WEnd EndFunc ;==>Spin Func Stop() Opt("GUIOnEventMode", 0) $Spin = False EndFunc ;==>Stop
    1 point
  4. please put the code between the code tags <> use the AU3Info Tool provided and post that data for the button you wish to click LOL, I would silent install it from command line Silent installation of RDX utilities on Windows systems
    1 point
  5. @Belini you have been around long enough to know you need to show some effort. A google search like this: yields over 400 results, many of which have examples with code in them. You cannot tell us you have looked at them all.
    1 point
  6. I did not find the option to mark as resolved by this I just changed the topic title!
    1 point
  7. Look up For...To...Step...Next in the AutoIt help file and notice "Step -1" is referring to the optional parameter stepval as in "[Step < numeric step value>]". The numeric step value being minus 1. My example 1 is the more traditional, faster method that all the helpers of this thread are referring to. #include <Array.au3> Local $aYear = [2019, 2007, 2014, 2018, 2013] Local $aYearNow = "2018" ; @YEAR ; This line does not need to be declared in each loop in the For - Next loop. Local $aYearA = $aYear ; Original $aYear array for use in both examples - Examples should return same answers. ; Example 1 For $x = UBound($aYearA) - 1 To 0 Step -1 $Compare = StringCompare($aYearA[$x], $aYearNow) ; Compare each element (where $x is the index of the element) of the array - Not the entire array as in your example. ConsoleWrite($Compare & @CRLF) ; StringCompare returns:- 0 when string1 and string2 are equal: ; 1 when string1 is greater than string2 ; -1 when string1 is less than string2 (see AutoIt help file) If $Compare < 0 Then _ArrayDelete($aYearA, $x) EndIf Next _ArrayDisplay($aYearA) ConsoleWrite("==== ConsoleWrites StringCompares in reverse order =====" & @CRLF) ; Example 2 For $Element In $aYear $Compare = StringCompare($Element, $aYearNow) ConsoleWrite($Compare & @CRLF) If $Compare < 0 Then _ArrayDelete($aYear, _ArraySearch($aYear, $Element)) ; _ArraySearch used because there is no array index readily available in this example. EndIf Next _ArrayDisplay($aYear)
    1 point
  8. KickStarter15

    File Search

    As always Subz. One of the best.
    1 point
  9. I know you already found your answer. I thought it would be helpful to show a function that sets multiple power options, including what you wanted. Func _SetPowerOptions() ;Set multiple power options. ;Set the current power plan standby timeout ("Put the computer to sleep") to "Never". Local $iPowercfgReturn = RunWait("powercfg -x standby-timeout-ac 0", '', @SW_HIDE) If @error Or $iPowercfgReturn <> 0 Then Return SetError(1, 0, False) ;Set monitor timeout ("Turn off the display") to 30 minutes. $iPowercfgReturn = RunWait("powercfg -x monitor-timeout-ac 30", '', @SW_HIDE) If @error Or $iPowercfgReturn <> 0 Then Return SetError(2, 0, False) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" ;Disable Hibernate. Local Const $sRegKeyPower = "HKEY_LOCAL_MACHINE" & $s64Bit & "\SYSTEM\CurrentControlSet\Control\Power" Local $iRegWriteReturn = RegWrite($sRegKeyPower, "HibernateEnabled", "REG_DWORD", 0) If @error Or $iRegWriteReturn <> 1 Then Return SetError(3, @error, False) Local Const $sRegKeyPowerSettings = "HKEY_LOCAL_MACHINE" & $s64Bit & "\SOFTWARE\Policies\Microsoft\Power\PowerSettings" ;Disable Sleep in the Start Menu. Local Const $sRegKeyPowerSettingsSleepStartMenu = $sRegKeyPowerSettings & "\abfc2519-3608-4c2a-94ea-171b0ed546ab" $iRegWriteReturn = RegWrite($sRegKeyPowerSettingsSleepStartMenu, "ACSettingIndex", "REG_DWORD", 0) If @error Or $iRegWriteReturn <> 1 Then Return SetError(4, @error, False) $iRegWriteReturn = RegWrite($sRegKeyPowerSettingsSleepStartMenu, "DCSettingIndex", "REG_DWORD", 0) If @error Or $iRegWriteReturn <> 1 Then Return SetError(5, @error, False) ;Set Sleep Button to "Do Nothing" Local Const $sRegKeyPowerSettingsSleepButton = $sRegKeyPowerSettings & "\96996BC0-AD50-47EC-923B-6F41874DD9EB" $iRegWriteReturn = RegWrite($sRegKeyPowerSettingsSleepButton, "ACSettingIndex", "REG_DWORD", 0) If @error Or $iRegWriteReturn <> 1 Then Return SetError(6, @error, False) $iRegWriteReturn = RegWrite($sRegKeyPowerSettingsSleepButton, "DCSettingIndex", "REG_DWORD", 0) If @error Or $iRegWriteReturn <> 1 Then Return SetError(7, @error, False) ;Set Power Button to "Shut down" Local Const $sRegKeyPowerSettingsPowerButton = $sRegKeyPowerSettings & "\7648EFA3-DD9C-4E3E-B566-50F929386280" $iRegWriteReturn = RegWrite($sRegKeyPowerSettingsPowerButton, "ACSettingIndex", "REG_DWORD", 3) If @error Or $iRegWriteReturn <> 1 Then Return SetError(8, @error, False) $iRegWriteReturn = RegWrite($sRegKeyPowerSettingsPowerButton, "DCSettingIndex", "REG_DWORD", 3) If @error Or $iRegWriteReturn <> 1 Then Return SetError(9, @error, False) ;Set "When I close the lid" to "Shut down" Local Const $sRegKeyPowerSettingsCloseLid = $sRegKeyPowerSettings & "\5CA83367-6E45-459F-A27B-476B1D01C936" $iRegWriteReturn = RegWrite($sRegKeyPowerSettingsCloseLid, "ACSettingIndex", "REG_DWORD", 3) If @error Or $iRegWriteReturn <> 1 Then Return SetError(10, @error, False) $iRegWriteReturn = RegWrite($sRegKeyPowerSettingsCloseLid, "DCSettingIndex", "REG_DWORD", 3) If @error Or $iRegWriteReturn <> 1 Then Return SetError(11, @error, False) Return True EndFunc ;==>_SetPowerOptions Adam
    1 point
  10. Hello, $hFileOpen = FileOpen("D:\Import.txt", 2) ... will open an empty file for write. This means, in case the file already exists, its content will be erased. If it didn't exist already, a new file will be created. FileWrite($hFileOpen,$YourString) ... will write your string to that file without adding a @CRLF at the end of the line that string was written to. In case you see a trailing empty line in your file, the string $YourString has a "trailing LINEFEED" at it's end. To cleanup that one use either StringStripWS() or StringRegExReplace() before writing the string to your file. You can use ... ConsoleWrite("""" & $YourString & """" & @CRLF) ... to see in the output pane of SciTE the result of writing your string to your file Regards, Rudi.
    1 point
  11. Subz

    execute cmd commands

    Just replace /k with /c should fix that.
    1 point
  12. TheSaint

    execute cmd commands

    So don't use it, just replace RunWait with RunAsWait. Look it up in the Help file for specific information about all the parameters. Example Local $sServiceName = "Service Name" RunAsWait("your username", "your domain", "your password", logon_flag, @ComSpec & ' /k net stop "' & $sServiceName & '"', "workingdir" [, show_flag [, opt_flag]]] ) Obviously you need to enter all the other required values (username, password, etc), use appropriate flags, specify the working directory maybe.
    1 point
  13. You may have noticed that WM_COMMAND messages are still handled correctly when you right-click in the small empty area below the TreeView. Only when you right-click in the TreeView area the messages are not handled correctly. When you right-click in a window WM_COMMAND messages are always send to the same window. If you right-click in the GUI WM_COMMAND messages are send to the GUI. If you right-click in the TreeView WM_COMMAND messages are to send to the TreeView. But GUIRegisterMsg is only able to catch messages which are send to the GUI. GUIRegisterMsg cannot catch messages which are send to the TreeView. The solution is to subclass the TreeView. Details in the codebox. I've added 10 code lines. #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> #include <GuiMenu.au3> #include <WinAPIShellEx.au3> Global $g_hTreeView Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo Example() Func Example() Local $hGUI, $hItem Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) $hGUI = GUICreate("(UDF Created) TreeView Create", 400, 300) $g_hTreeView = _GUICtrlTreeView_Create($hGUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Local $pTreeViewMsgHandler = DllCallbackGetPtr( DllCallbackRegister( "TreeViewMsgHandler", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) ) _WinAPI_SetWindowSubclass( $g_hTreeView, $pTreeViewMsgHandler, 0, 0 ) ; $iSubclassId = 0, $pData = 0 _GUICtrlTreeView_BeginUpdate($g_hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($g_hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($g_hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($g_hTreeView) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_RemoveWindowSubclass( $g_hTreeView, $pTreeViewMsgHandler, 0 ) GUIDelete() EndFunc ;==>Example Func TreeViewMsgHandler( $hWnd, $iMsg, $wParam, $lParam, $iSubclassId, $pData ) Switch $iMsg Case $WM_COMMAND Switch $wParam Case $e_idOpen _DebugPrint("WM_COMMAND " & $wParam & " Open") Case $e_idSave _DebugPrint("WM_COMMAND " & $wParam & " Save") Case $e_idInfo _DebugPrint("WM_COMMAND " & $wParam & " Info") EndSwitch EndSwitch ; Call next function in subclass chain (this forwards Windows messages to main GUI) Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0] EndFunc Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam ;ConsoleWrite($GUI_RUNDEFMSG & @CRLF) ;Switch $wParam ; Case $hTreeView Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True ;EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_CONTEXTMENU Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case $e_idOpen _DebugPrint("WM_COMMAND " & $wParam & " Open") Case $e_idSave _DebugPrint("WM_COMMAND " & $wParam & " Save") Case $e_idInfo _DebugPrint("WM_COMMAND " & $wParam & " Info") EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $g_hTreeView If Not IsHWnd($g_hTreeView) Then $hWndTreeview = GUICtrlGetHandle($g_hTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint
    1 point
  14. @lokster: There are people who write programs for fun -- that's cool. There are other people that want to be paid for their efforts on writing something -- that's cool too. There are people who work on software houses and get paid to write commercial software -- we all know that and use their programs. There are people who create such companies in their homes and sell their programs through the internet -- no problem with that. There are people who want to use free software -- that's cool too. There are people who want to buy commercial software -- that's acceptable. You know we live in a free world. Anybody can do whatever he/she wants. I have no problem with that if it doesn't insult me. Your second post was, probably to all of us, something like: "hey, what are you trying to tell us here? to use trialware code in our AU3 scripts? AU3 is free, and we want all the scripts written using it to be free too!". That's wrong. AU3 is the media to do something. What are you going to do with it, it's up to you considering that you respect its license. I'm sorry but it's on anyones free will to sell software, to buy software or to use free software. And since all these are on one's free will, your personal statement is simply irrelevant to this topic. So keep it for yourself and make your comments only for the coding part (if you have any). Do us a favour and leave your ethic aside, please. You are off-topic. @ChrisL: Thank you for sharing this with us mate.
    1 point
  15. Hi I am pretty new to Autoit and all this scripting things i want to use ImageSearch but i cant get the right date to start the scripting i would be thankfull if someone would give me the download link for every single date i need to use Imagesearch
    0 points
  16. raycred

    Chrome UDF

    Thats not work with windows 10
    0 points
×
×
  • Create New...