Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/10/2013 in all areas

  1. DaleHohm

    LibrariesIE.au3

    File Name: IE.au3 File Submitter: DaleHohm File Submitted: 27 Mar 2013 File Category: Libraries Title: Internet Explorer Automation UDF Library for AutoIt3 Filename: IE.au3 Description: A collection of functions for creating, attaching to, reading from and manipulating Internet Explorer Author: DaleHohm Version: T3.0-0 Last Update: 9/3/12 Requirements: AutoIt3 3.3.9 or higher This version is checked into the development stream for the next AutoIt beta release, but will work with the most recently released V3.3.9.x beta. I am releasing it here so that it can get some testing now and help some people with some of the issues it fixes in the realm of COM error handling (and "the WEND error"). This file will be removed when it is included in a public beta release. Dale
    1 point
  2. czardas

    _ArrayUniqueConcatenate

    After some insightful input by kylomas in >this topic, I decided to make a general resusable function using the same ideas. It handles up to 24 arrays. Zero based arrays go in, and the target array is returned ByRef. Before passing arrays to this function, you need to delete element 0 if it contains the item count; and you need to use Ubound to get the new size of the target array after using the function. If processing large arrays it is a good idea to delete the arrays you no longer need after the concatenation. The function returns the number of removed duplicates. Set case sensitivity using the second parameter 0 = case insensitive, 1 = case sensitive. ; Func _ArrayUniqueConcatenate(ByRef $aTarget, $iCasesense = 0, _ ; up to 23 more arrays can be included $a0 = 0, $a1 = 0, $a2 = 0, $a3 = 0, $a4 = 0, $a5 = 0, $a6 = 0, $a7 = 0, $a8 = 0, $a9 = 0, $a10 = 0, $a11 = 0, _ $a12 = 0, $a13 = 0, $a14 = 0, $a15 = 0, $a16 = 0, $a17 = 0, $a18 = 0, $a19 = 0, $a20 = 0, $a21 = 0, $a22 = 0) #forceref $a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10, $a11, $a12, $a13, $a14, $a15, $a16, $a17, $a18, $a19, $a20, $a21, $a22 If Not IsArray($aTarget) Or UBound($aTarget, 0) <> 1 Then Return SetError(1) Local $iTotalSize = UBound($aTarget), $iItems = 0, $tVarName If $iCasesense Then For $i = 0 To $iTotalSize -1 $tVarName = "_" & StringToBinary($aTarget[$i], 2) If IsDeclared($tVarName) = -1 Then ContinueLoop Assign($tVarName, "", 1) $aTarget[$iItems] = $aTarget[$i] $iItems += 1 Next Else For $i = 0 To $iTotalSize -1 $tVarName = "_" & StringToBinary(StringLower($aTarget[$i]), 2) If IsDeclared($tVarName) = -1 Then ContinueLoop Assign($tVarName, "", 1) $aTarget[$iItems] = $aTarget[$i] $iItems += 1 Next EndIf Local $iParams = @NumParams If $iParams > 2 Then Local $aNextArray, $iBound For $i = 0 To $iParams -3 $aNextArray = Eval('a' & $i) If Not IsArray($aNextArray) Or UBound($aNextArray, 0) <> 1 Then Return SetError(2, $i +3) ; Sets @Extended to the parameter which failed $iBound = UBound($aNextArray) $iTotalSize += $iBound ReDim $aTarget[$iItems + $iBound] If $iCasesense Then For $j = 0 To $iBound -1 $tVarName = "_" & StringToBinary($aNextArray[$j], 2) If IsDeclared($tVarName) = -1 Then ContinueLoop Assign($tVarName, "", 1) $aTarget[$iItems] = $aNextArray[$j] $iItems += 1 Next Else For $j = 0 To $iBound -1 $tVarName = "_" & StringToBinary(StringLower($aNextArray[$j]), 2) If IsDeclared($tVarName) = -1 Then ContinueLoop Assign($tVarName, "", 1) $aTarget[$iItems] = $aNextArray[$j] $iItems += 1 Next EndIf Execute('_FreeMemory($a' & $i & ')') Next EndIf ReDim $aTarget[$iItems] Return $iTotalSize - $iItems ; Return the number of duplicates removed EndFunc ; _ArrayUniqueConcatenate Func _FreeMemory(ByRef $vParam) $vParam = 0 EndFunc ; In the following test, after randomly filling 24 arrays of 50000 elements (each with 2 ascii characters), the function searches (case insensitive) through 1200000 elements removing all duplicates in just a few seconds. Filling the arrays takes a few seconds to begin with (watch the SciTE console). It should hit the expected limit of 38416 possible 2 case insensitive character combinations and remove 1161584 duplicates. It takes about 13 12 seconds on my machine. Also works with unicode. ; #include <Array.au3> #include <String.au3> Global $a1[50000], $a2[50000], $a3[50000], $a4[50000], $a5[50000], $a6[50000], $a7[50000], $a8[50000], _ $a9[50000], $a10[50000], $a11[50000], $a12[50000], $a13[50000], $a14[50000], $a15[50000], $a16[50000], _ $a17[50000], $a18[50000], $a19[50000], $a20[50000], $a21[50000], $a22[50000], $a23[50000], $a24[50000] ConsoleWrite("Populating Arrays" & @LF) For $i = 1 To 24 Execute('_Fill($a' & $i & ')') Next ConsoleWrite("Starting Timer" & @LF) Local $iTimer = TimerInit() Local $ret = _ArrayUniqueConcatenate($a1, 0, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10, $a11, $a12, $a13, $a14, $a15, $a16, $a17, $a18, $a19, $a20, $a21, $a22, $a23, $a24) ConsoleWrite("Error = " & @error & @lf & "Seconds = " & TimerDiff($iTimer)/1000 & @LF & "Unique Items = " & UBound($a1) & @LF & "Duplicates removed = " & $ret & @LF) For $i = 2 To 24 Execute('_FreeMemory($a' & $i & ')') Next _ArrayDisplay($a1) Func _FreeMemory(ByRef $vParam) $vParam = 0 EndFunc Func _Fill(ByRef $aArray) For $i = 0 To UBound($aArray) -1 $aArray[$i] = _HexToString(_RandomHexStr(4)) Next EndFunc Func _RandomHexStr($sLen) Local $sHexString = "" For $i = 1 To $sLen $sHexString &= StringRight(Hex(Random(0, 15, 1)), 1) Next Return $sHexString EndFunc ;==> _RandomHexStr Func _ArrayUniqueConcatenate(ByRef $aTarget, $iCasesense = 0, _ ; up to 23 more arrays can be included $a0 = 0, $a1 = 0, $a2 = 0, $a3 = 0, $a4 = 0, $a5 = 0, $a6 = 0, $a7 = 0, $a8 = 0, $a9 = 0, $a10 = 0, $a11 = 0, _ $a12 = 0, $a13 = 0, $a14 = 0, $a15 = 0, $a16 = 0, $a17 = 0, $a18 = 0, $a19 = 0, $a20 = 0, $a21 = 0, $a22 = 0) #forceref $a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10, $a11, $a12, $a13, $a14, $a15, $a16, $a17, $a18, $a19, $a20, $a21, $a22 If Not IsArray($aTarget) Or UBound($aTarget, 0) <> 1 Then Return SetError(1) Local $iTotalSize = UBound($aTarget), $iItems = 0, $tVarName If $iCasesense Then For $i = 0 To $iTotalSize -1 $tVarName = "_" & StringToBinary($aTarget[$i], 2) If IsDeclared($tVarName) = -1 Then ContinueLoop Assign($tVarName, "", 1) $aTarget[$iItems] = $aTarget[$i] $iItems += 1 Next Else For $i = 0 To $iTotalSize -1 $tVarName = "_" & StringToBinary(StringLower($aTarget[$i]), 2) If IsDeclared($tVarName) = -1 Then ContinueLoop Assign($tVarName, "", 1) $aTarget[$iItems] = $aTarget[$i] $iItems += 1 Next EndIf Local $iParams = @NumParams If $iParams > 2 Then Local $aNextArray, $iBound For $i = 0 To $iParams -3 $aNextArray = Eval('a' & $i) If Not IsArray($aNextArray) Or UBound($aNextArray, 0) <> 1 Then Return SetError(2, $i +3) ; Sets @Extended to the parameter which failed $iBound = UBound($aNextArray) $iTotalSize += $iBound ReDim $aTarget[$iItems + $iBound] If $iCasesense Then For $j = 0 To $iBound -1 $tVarName = "_" & StringToBinary($aNextArray[$j], 2) If IsDeclared($tVarName) = -1 Then ContinueLoop Assign($tVarName, "", 1) $aTarget[$iItems] = $aNextArray[$j] $iItems += 1 Next Else For $j = 0 To $iBound -1 $tVarName = "_" & StringToBinary(StringLower($aNextArray[$j]), 2) If IsDeclared($tVarName) = -1 Then ContinueLoop Assign($tVarName, "", 1) $aTarget[$iItems] = $aNextArray[$j] $iItems += 1 Next EndIf Execute('_FreeMemory($a' & $i & ')') Next EndIf ReDim $aTarget[$iItems] Return $iTotalSize - $iItems ; Return the number of duplicates removed EndFunc ; _ArrayUniqueConcatenate
    1 point
  3. how about this: $allAelements = _IETagNameGetCollection($IEObject, "a") if IsObj($allAelements) Then For $oneAelement in $allAelements If $oneAelement.innertext == "Protect" Then _IEAction($oneAelement, "Focus") _IEAction($oneAelement, "Click") ExitLoop EndIf Next EndIf
    1 point
  4. This is for an Autoit GUI-Control _IsChecked() You need to use... _IEFormElementCheckBoxSelect() See the help file for use Almost all the commands you want to use starts with _IE 8)
    1 point
  5. trancexx

    JSON, I hate it.

    Oh, then it's MVP member, old member, trusted member or trancexx. Okly dokly. That's fine.
    1 point
  6. If you're looking to delete items out of a folder, I would suggest looking up RecFileListToArray in the Examples section. Something like this should work: #include <RecFileListToArray.au3> $dir = @DesktopDir & "\Test" Local $aArray = _RecFileListToArray($dir, "*", 1, 0, 1, 2) If IsArray($aArray) Then For $i = 1 To $aArray[0] FileDelete($aArray[$i]) Next Else MsgBox(0, "", "No files in directory") EndIf
    1 point
  7. Or you could replace shutdown.exe. Or you could wait for the shutdown.exe process and kill it before it kills you. There are many ways to skin a cat. Trying to entice it through a blender with a toy mouse is not necessarily the best way.
    1 point
  8. PhoenixXL

    Animated pointer

    OK, Now I get it The following should help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Storm Production Software Suite - Trumpf500;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Author: JohnPaul Niswonger ;; ;; Script name: SPSS_T500.au3 ;; ;; Date Started: Aug/7/2013 ;; ;; Date Published: -/-/- ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #region ; Pre-GUI #region ; Includes begin here: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <SendMessage.au3> #include <Misc.au3> #include <_RecFileListToArray.au3> #include <String.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <Toast.au3> #NoTrayIcon #endregion ; Includes begin here: #region ; Options are set here: Opt("GUIOnEventMode", 1) Opt("GUICloseOnEsc", 1) Opt("MouseCoordMode", 2) #endregion ; Options are set here: #region ; Special Chr and coding begins here: Global $Qmark = Chr(34) Global $Comma = Chr(44) Global $InputDef = "Program Currently Loaded: " Global $cHour = @HOUR Global $cMin = @MIN Global $cDay = @MDAY Global $cMonth = @MON Global $cYear = @YEAR Global $Pointer Global $StopLoop = False Global $InputData Global $SelectProgramList Global $SearchResults Global $sPath Global $sLabel Global $CurrentProgram Global $SendValue = False Global $TBValue = False Global $LoginValue = False $gdi_Logo = 0 $LOGO = 0 #endregion ; Special Chr and coding begins here: #region ; Main GUI begins here: #region ; $MainGUI $MainGUI = GUICreate("MainGUI", 774, 580, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP)) GUISetBkColor(0xFFFFFF) GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose") GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainGUIMinimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "MainGUIMaximize") GUISetOnEvent($GUI_EVENT_RESTORE, "MainGUIRestore") GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") #endregion ; $MainGUI #region ; Invisible Blocks behind buttons: #region ; $Block1 $Block1 = GUICtrlCreateGraphic(10, 252, 125, 15) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0xFFFFFF) #endregion ; $Block1 #region ; $Block2 $Block2 = GUICtrlCreateGraphic(10, 306, 125, 15) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0xFFFFFF) #endregion ; $Block2 #region ; $Block3 $Block3 = GUICtrlCreateGraphic(10, 360, 125, 15) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0xFFFFFF) #endregion ; $Block3 #region ; $Block4 $Block4 = GUICtrlCreateGraphic(10, 414, 125, 15) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0xFFFFFF) #endregion ; $Block4 #region ; $Block5 $Block5 = GUICtrlCreateGraphic(0, 212, 10, 400) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0xFFFFFF) #endregion ; $Block5 #endregion ; Invisible Blocks behind buttons: #region ; $Slogan $Slogan = GUICtrlCreateLabel($Qmark & "Every Order" & $Comma & " Every Time" & $Qmark, 525, 40, 200, 20) GUICtrlSetFont(-1, 12, 800, 0, "Arimo") #endregion ; $Slogan #region ; Black frame around data: #region ; $gHorBar1 $gHorBar1 = GUICtrlCreateGraphic(175, 125, 600, 15) GUICtrlSetBkColor(-1, 0x3B3B3B) GUICtrlSetState(-1, $GUI_DISABLE) #endregion ; $gHorBar1 #region ; $gHorBar2 $gHorBar2 = GUICtrlCreateGraphic(475, 105, 400, 20) GUICtrlSetBkColor(-1, 0x3B3B3B) GUICtrlSetState(-1, $GUI_DISABLE) #endregion ; $gHorBar2 #region ; $gVertBar1 $gVertBar1 = GUICtrlCreateGraphic(175, 125, 15, 550) GUICtrlSetBkColor(-1, 0x3B3B3B) GUICtrlSetState(-1, $GUI_DISABLE) #endregion ; $gVertBar1 #region ; $gVertBar2 $gVertBar2 = GUICtrlCreateGraphic(10, 428, 125, 200) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0x353535) #endregion ; $gVertBar2 #region ; $Input1 $Input1 = GUICtrlCreateInput("", 503, 112, 250, 20) GUICtrlSetOnEvent(-1, "Input1ENTER") #endregion ; $Input1 #endregion ; Black frame around data: #region ; MainGUI Buttons: #region ; $mButton1 $mButton1 = GUICtrlCreateLabel(@CR & "SEND PROGRAM", 10, 212, 125, 40, $SS_CENTER) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0x353535) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "_Send_Program") #endregion ; $mButton1 #region ; $mButton2 $mButton2 = GUICtrlCreateLabel(@CR & "TOOL BOX", 10, 266, 125, 40, $SS_CENTER) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0x353535) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "_Tool_Box") #endregion ; $mButton2 #region ; $mButton3 $mButton3 = GUICtrlCreateLabel(@CR & "LOGIN", 10, 320, 125, 40, $SS_CENTER) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0x353535) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "_Login") #endregion ; $mButton3 #region ; $mButton4 $mButton4 = GUICtrlCreateLabel(@CR & "RESET", 10, 374, 125, 40, $SS_CENTER) GUICtrlSetCursor(-1, 16) GUICtrlSetBkColor(-1, 0x353535) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "Reset") #endregion ; $mButton4 #region ; $mButton5 $mButton5 = GUICtrlCreateLabel(@CR & "X", 740, -10, 35, 30, $SS_CENTER) GUICtrlSetCursor(-1, 0) GUICtrlSetBkColor(-1, 0x353535) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "MainGUIClose") #endregion ; $mButton5 #endregion ; MainGUI Buttons: #region ; $Clock $Clock = GUICtrlCreateLabel(@CR & $cDay & "/" & $cMonth & "/" & $cYear & " - " & $cHour - 12 & ":" & $cMin, 10, 428, 125, 40, $SS_CENTER) GUICtrlSetBkColor(-1, 0x353535) GUICtrlSetColor(-1, 0xFFFFFF) #endregion ; $Clock $Pointer = GUICtrlCreatePic(@ScriptDir & "\test_res\storm_newlogo_pointer.jpg", 140, 220, 26, 25) Global $iHeight = _WinAPI_GetWindowHeight(GUICtrlGetHandle(-1)) GUICtrlSetState(-1, $GUI_HIDE) GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT GUISetState(@SW_SHOW, "MainGUI") #endregion ; Main GUI begins here: #endregion ; Pre-GUI #region ; Post-GUI GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND");GUI watches for double click AdlibRegister("ClockSetTime", 15000);Check and update clock every 15 seconds _GDIPlus_Startup() $gdi_Logo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\test_res\storm_newlogo_title_sm.PNG") $LOGO = _GDIPlus_GraphicsCreateFromHWND($MainGUI) _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435) Local $aInfoMouse, $f_PointerON While 1 Sleep(10) $aInfoMouse = GUIGetCursorInfo($MainGUI) If IsArray($aInfoMouse) = 0 Then ContinueLoop Switch $aInfoMouse[0] Case 10 To 135 ;the X-Range Switch $aInfoMouse[1] Case 212 To 414 ;the Y-Range GUICtrlSetPos($Pointer, 140, $aInfoMouse[1] - $iHeight / 2) If $f_PointerON = False Then GUICtrlSetState($Pointer, $GUI_SHOW) $f_PointerON = True EndIf ContinueLoop EndSwitch EndSwitch If $f_PointerON Then GUICtrlSetState($Pointer, $GUI_HIDE) $f_PointerON = False EndIf WEnd #region ;Functions begin here: #region ; GUICtrl Functions: Func ClockSetTime() GUICtrlSetData($Clock, @CR & @MDAY & "/" & @MON & "/" & @YEAR & " - " & @HOUR - 12 & ":" & @MIN) EndFunc ;==>ClockSetTime Func Search() Local $SearchPath = FileRead(@ScriptDir & "\test_res\PSS_T500_FilePath_Holder.txt") Local $InputData = GUICtrlRead($Input1) Local $SearchResults = _RecFileListToArray($SearchPath, $InputData & "*.lst*", 1, 1, 0, 2) If @error Then Local $eNote = _Toast_Show(0, "Error Code = " & @error, "Unable to locate file", 5) _Toast_Hide() Else Local $tResults = _ArrayToString($SearchResults) $sLabel = GUICtrlCreateLabel("Choose a program to begin: ", 275, 175, 200, 20) $SelectProgramList = GUICtrlCreateList("", 275, 200, 400, 100) GUICtrlSetData(-1, $tResults) EndIf EndFunc ;==>Search Func Input1ENTER() GUICtrlDelete($sLabel) GUICtrlDelete($SelectProgramList) Search() GUICtrlSetData($Input1, "") EndFunc ;==>Input1ENTER Func Display_Results() $SendValue = True $TBValue = True $LoginValue = True EndFunc ;==>Display_Results Func _Send_Program() If $SendValue = False Then MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @LF & '$SendValue' & @LF & @LF & 'Return:' & @LF & $SendValue) ;### Debug MSGBOX Else MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @LF & '$SendValue' & @LF & @LF & 'Return:' & @LF & $SendValue) ;### Debug MSGBOX EndIf EndFunc ;==>_Send_Program Func _Tool_Box() If $TBValue = False Then MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @LF & '$TBValue' & @LF & @LF & 'Return:' & @LF & $TBValue) ;### Debug MSGBOX Else MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @LF & '$TBValue' & @LF & @LF & 'Return:' & @LF & $TBValue) ;### Debug MSGBOX EndIf EndFunc ;==>_Tool_Box Func _Login() If $LoginValue = False Then $LoginValue = InputBox("Log In", "Enter Your Employee ID" & @CRLF, "", "*") Else MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @LF & '$LoginValue' & @LF & @LF & 'Return:' & @LF & $LoginValue) ;### Debug MSGBOX EndIf EndFunc ;==>_Login #endregion ; GUICtrl Functions: #region ; Drag&Drop, GDI-PNG-Drawing, and Window Dragging Functions: Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam);Dbl-clk processing #forceref $hWnd, $iMsg, $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $iCode Case $LBN_DBLCLK Switch $iIDFrom Case $SelectProgramList $CurrentProgram = GUICtrlRead($SelectProgramList) ; Use the native function GUICtrlDelete($SelectProgramList) GUICtrlDelete($sLabel) Display_Results() EndSwitch EndSwitch EndFunc ;==>_WM_COMMAND Func WM_PAINT($MainGUI, $iMsg, $wParam, $lParam);PNG drawing _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435) Return 'GUI_RUNDEFMSG' EndFunc ;==>WM_PAINT Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam);Window Dragging #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST #endregion ; Drag&Drop, GDI-PNG-Drawing, and Window Dragging Functions: #region ; Window-Control Functions: Func MainGUIClose();Shuts down and disposes of GDI elements, Deletes GUI and exits script _GDIPlus_GraphicsDispose($gdi_Logo) _GDIPlus_ImageDispose($LOGO) _GDIPlus_Shutdown() GUIDelete("MainGUI") Exit EndFunc ;==>MainGUIClose Func Reset();Exits, then runs the script again, thus resetting it If @Compiled Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc ;==>Reset Func MainGUIMaximize() EndFunc ;==>MainGUIMaximize Func MainGUIMinimize() EndFunc ;==>MainGUIMinimize Func MainGUIRestore() EndFunc ;==>MainGUIRestore #endregion ; Window-Control Functions: #endregion ;Functions begin here: PS: I you want to get help for a specific problem you should create a small reproducer rather than supplying the whole script. Its easier to modify the script that is made just for the correction. Regards
    1 point
  9. FireFoxBad guess. "[d]" is the same as "[0-9]" which is the same as "d". If you want only to extract the numbers between brackets, use this simple pattern: "[(d+)]".
    1 point
  10. Alexxander, The RegExp solution given will extract all numbers, if you want only to extract the numbers between brackets, use this simple pattern: "[d]". PS: A forum search will be faster than creating a topic and waiting for answers Br, FireFox.
    1 point
  11. This is a trivial question, giving an example is not going to solve his lack of "reading the helpfile".
    1 point
  12. Local $aFinal $aString = "[24] hi all i'am an example" $aResult = StringRegExp($aString, "\d", 3) For $x = 0 To UBound($aResult) -1 $aFinal &= $aResult[$x] Next ConsoleWrite($aFinal)
    1 point
  13. Hi, Have you looked at the String* functions in the helpfile? Especially StringMid/StringInStr or _StringBetween? (or StringRegExp but I doubt you will be able to do something with it). Br, FireFox.
    1 point
  14. Jon

    AutoIt v3.3.9.20 Beta

    I'm going to go for *ANYCRLF as default. Shoot me! (Edit: I Love how until this was brought up, the old default of LF was fine...haha)
    1 point
  15. Hi careca, I have some concerns why you are using the Windows directory. My example is not going there. Another is writing to HKCR. This is a merged root key created for easy reading of classes. It is not a good idea to write to it. 2 keys exist for writing classes are HKCUSOFTWAREClasses HKLMSOFTWAREClasses Writing to HKCR can mess things up as it does not know to which of those 2 above paths that it is writing to. Notice in the CommandStore that keys are listed as for e.g. Windows.playmusic. This is done so keys are unique. So may I suggest you follow with a similar naming scheme. This is a regfile that I tested with Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\BPlayer] "MUIVerb"="BPlayer" "SubCommands"="BPlayer.Play;BPlayer.List" "icon"="C:\\BPlayer\\BPlayer.ico" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\BPlayer.Play] "MUIVerb"="Play" "icon"="C:\\BPlayer\\BPlayer.ico" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\BPlayer.Play\command] @="\"C:\\BPlayer\\Beats Player 1.6.exe\" /P \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\BPlayer.List] "MUIVerb"="Add to list" "icon"="C:\\BPlayer\\BPlayer.ico" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\BPlayer.List\command] @="\"C:\\BPlayer\\Beats Player 1.6.exe\" /L \"%1\"" This is the script that was compiled as "Beats Player 1.6.exe" to test with Global $action, $file_to_play If $CMDLINE[0] Then For $1 = 1 To $CMDLINE[0] Switch $CMDLINE[$1] Case '/P' $action = 'play' Case '/L' $action = 'list' Case Else If FileExists($CMDLINE[$1]) Then $file_to_play = $CMDLINE[$1] EndIf EndSwitch Next EndIf MsgBox(0, @ScriptName, _ '$action = ' & $action & @CRLF & _ '$file_to_play = ' & $file_to_play & @CRLF _ ) If I right click on "Beats Player 1.6.exe" and select BPlayer -> Play from the context menu then I get a Msgbox with this --------------------------- Beats Player 1.6.exe --------------------------- $action = play $file_to_play = C:\BPlayer\Beats Player 1.6.exe --------------------------- OK --------------------------- In the registry, %1 is replaced with the path of the highlighted file from explorer. This is how you get the path.
    1 point
  16. Here's a small example for you, don't just copy & paste, peruse the helpfile and study it: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ;START gUI $GUI1 = GUICreate("Rectangle Example", 448, 240, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIClose") $border = GUICtrlCreateGraphic(55, 16, 336, 145) GUICtrlSetGraphic($border, $GUI_GR_COLOR, 0x00000, 0xFF0000) GUICtrlSetGraphic($border, $GUI_GR_RECT, 0, 0, 322, 126) $Button1 = GUICtrlCreateButton("Green", 56, 192, 89, 33) GUICtrlSetOnEvent(-1, "TurnGreen") $Button2 = GUICtrlCreateButton("Blue", 176, 192, 89, 33) GUICtrlSetOnEvent(-1, "TurnBlue") $Button3 = GUICtrlCreateButton("Purple", 288, 192, 89, 33) GUICtrlSetOnEvent(-1, "TurnPurple") GUISetState(@SW_SHOW) ;END GUI While 1 WEnd Func GUIClose() Exit EndFunc ;==>GUIClose Func TurnGreen() GUICtrlSetGraphic($border, $GUI_GR_COLOR, 0x00000, 0x00FF00) GUICtrlSetGraphic($border, $GUI_GR_RECT, 0, 0, 322, 126) GUICtrlSetGraphic($border, $GUI_GR_REFRESH) EndFunc ;==>TurnGreen Func TurnBlue() GUICtrlSetGraphic($border, $GUI_GR_COLOR, 0x00000, 0x0080FF) GUICtrlSetGraphic($border, $GUI_GR_RECT, 0, 0, 322, 126) GUICtrlSetGraphic($border, $GUI_GR_REFRESH) EndFunc ;==>TurnBlue Func TurnPurple() GUICtrlSetGraphic($border, $GUI_GR_COLOR, 0x00000, 0x8000FF) GUICtrlSetGraphic($border, $GUI_GR_RECT, 0, 0, 322, 126) GUICtrlSetGraphic($border, $GUI_GR_REFRESH) EndFunc ;==>TurnPurple Also, you should put your code in autoit tags so that it will show like above... You should pay attention to this line of code: GUICtrlSetGraphic($border, $GUI_GR_REFRESH) it's very important.
    1 point
  17. I hope you have already read a lot, either: link proposed by my previous speaker as well as documentation. Now try to go through the analysis of: #include <IE.au3> Local $fDestinationDir = 'C:\test' Local $fDestinationName = 'google.htm' If FileExists($fDestinationDir) = 0 Then DirCreate($fDestinationDir) Local $oIE = _IECreate('www.google.com') SendKeepActive('[REGEXPTITLE:(?i).*Google.*Internet Explorer.*]') Send('^s') SendKeepActive('') WinWaitActive('Zapisywanie strony sieci Web', '&Zapisz') ControlSend('Zapisywanie strony sieci Web', '&Zapisz', 'Edit1', $fDestinationDir & '{ENTER}') WinWaitActive('Zapisywanie strony sieci Web', 'Adres: ' & $fDestinationDir) ControlSetText('Zapisywanie strony sieci Web', '&Zapisz', 'Edit1', '') ControlSend('Zapisywanie strony sieci Web', '&Zapisz', 'Edit1', $fDestinationName & '{ENTER}') ;~ or instead of ;~ ControlSetText('Zapisywanie strony sieci Web', '&Zapisz', 'Edit1', '') ;~ ControlSend('Zapisywanie strony sieci Web', '&Zapisz', 'Edit1', $fDestinationName & '{ENTER}') ;~ You can use this: ;~ ControlSetText('Zapisywanie strony sieci Web', '&Zapisz', 'Edit1', $fDestinationName) ;~ ControlClick('Zapisywanie strony sieci Web', '&Zapisz', '[CLASS:Button; TEXT:&Zapisz]') Sleep(2000) _IEQuit($oIE) Of course you have to change the name of the Polish (Title and Text), as appropriate for your language. hint: you can further modify my example using: _IEAction I encourage you to read the documentation..
    1 point
  18. JohnOne

    picking IE save location

    See >this answer you had? Try the same, the person who helped you may have gotten the ID parameter by using 'window info tool' located in AutoIt install folder.
    1 point
  19. Well when I find something works well for me I tend to make use of it very often as most of us do and so when I make a tutorial video you may find through habit my ways of doing things will be present. My intention is to give other people the same chance to make use of this great language as I have had. Yes there will be differences between how I do things and how others do things but difference is the juice of life. If everyone did the same things in the same ways the creativity would not flow as freely. People are free to do things in what ever way works for them, so when I make a video people will learn how to do something and from that point the more they understand the language they will learn their own tricks and preferences. It is just the way of things. I learned originally from 403 forbidden's video tutorials and the help file, however choice is always good. Not everyone will like his videos, voice, style etc. Similarly some people may not like my videos, voice or style but having choices available is preferable to feeling restricted. Contrast will teach people different methods of doing the same things so please do not be afraid to share your tutorials, help or tips for fear of "polluting" someone's coding method with your own style. Let them learn and find what works for them.
    1 point
  20. CroatianPig, The "programming language" is not your problem. This project is significantly bigger than "create a gui with some buttons" which is how the thread started. I am suggesting the following with your best interests at heart. You are clearly a beginner at both AutoIT and programming / system development. Three things are standing in your way: - lack of planning - lack of formal definition - impatience You have shown some aptitude for picking up the language. Now you need to slow down a bit and truly understand what each function / instruction / operator is doing. Some of your questions suggest that you are reading the doc, but not understanding all of the implications (understandable for a new programmer). Now that you have gotten your hands wet, take a step back and document what you really want to do. Define the kinds of data that you will need, how the data will be stored, presented and used. Following that, define your task at a very high level. Then start breaking each "thing" that you want to do into smaller and smaller pieces. Each of these piece is what you will code from. If you are familiar with programming flowcharts, use this to document your task. All that you want to do can be done with one driver gui, some subordinate gui's (product/customer/inventory definition for example) and an SQLite DB. At this point I would recommend NOT using an *.INI file, the SQLite UDF makes SQLite as simple as using an INI file for data storage. Final Comment... I know this seems like a waste of time and you don't want to "throw away what you've done" or "change directions". However, it will pay dividends later, especially slowing down and understanding what you are reading in the Help file and example scripts. Good Luck, kylomas
    1 point
  21. The latest beta owns a helpfile with a brand new regex dedicated page
    1 point
  22. But it is an edit control and we are speaking about ListBox, can you provide an example for a listbox ?
    1 point
  23. You will need to either edit or create the file: "desktop.ini" in the folder whose icon that you want to modify. the basic syntax for a customized icon i like so: [.ShellClassInfo] IconResource=C:Windowssystem32SHELL32.dll,19 Be advised that if the Desktop.ini file already exists you may have to change the attributes to modify or overwrite the file. You will also need to refresh the icon cache to view the updated icon. As an example: $Folder = "C:Your Folder" FileSetAttrib($Folder & "Desktop.ini", "-RASHNOT") $hOpen = FileOpen($Folder & "Desktop.ini", 2) FileWrite($hOpen, "[.ShellClassInfo]" & @LF & "IconResource=C:Windowssystem32SHELL32.dll,16") FileClose($hOpen) DllCall('shell32.dll', 'none', 'SHChangeNotify', 'long', 0x08000000, 'uint', 0, 'ptr', 0, 'ptr', 0) ;Refresh Icons
    1 point
  24. zFrank

    Folder icon change

    @ cyanidemonkey your code works fine because Desktop.ini needs +SHR attribs to work.
    1 point
  25. rasim

    Folder icon change

    cyanidemonkey Hmm... but above code works fine for me, try this: $folder = FileSelectFolder("Choose folder...", "") If @error Then Exit $ico = FileOpenDialog("Select a file...", "", "Icon contains files (*.ico;*.exe;*.dll)", 1) If @error Then Exit IniWriteSection($folder & "\" & "Desktop.ini", ".ShellClassInfo", _ "IconFile=" & $ico & @LF & _ "IconIndex=0" & @LF & _ "InfoTip=AutoIt RULEZZZ!") FileSetAttrib($folder & "\" & "Desktop.ini", "+H") FileSetAttrib($folder, "+R")Edit: This should be work.
    1 point
×
×
  • Create New...