Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/29/2018 in all areas

  1. for professional logging look no further than log4a.au3 found in the samples forum. and do this in the main AU3 file, all others just include the log4a.au3 #include 'log4a.au3' #Region ;**** Logging **** ; Enable logging and don't write to stderr _log4a_SetEnable() ; Write to stderr, set min level to warn, customize message format _log4a_SetErrorStream() _log4a_SetCompiledOutput($LOG4A_OUTPUT_FILE) _log4a_SetMinLevel($LOG4A_LEVEL_DEBUG) ; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled _log4a_SetFormat("${date} | ${host} | ${level} | ${message}") #EndRegion ;**** Logging **** In that configuration, the logger will log to your Editor output window, if compiled it creates a log file automatically with the script name. you can set your own minimum levels and stuff.
    1 point
  2. Melba23

    Random (letters?)

    BUNNY3005, You need to get the desktop files into an array - the code then adds the matching names to the list. This should work: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <Array.au3> #include <GuiListBox.au3> #include <WinAPIDlg.au3> #include <File.au3> Global $hGUI, $cInput, $cList, $sPartialData, $asFile ; Create an array full of files sFile() $hGUI = GUICreate("Example", 200, 400) $cInput = GUICtrlCreateInput("", 5, 5, 190, 20) $cList = GUICtrlCreateList("", 5, 30, 190, 325, BitOR(0x00100000, 0x00200000)) $cButton = GUICtrlCreateButton("Read", 60, 360, 80, 30) $cUP = GUICtrlCreateDummy() $cDOWN = GUICtrlCreateDummy() $cENTER = GUICtrlCreateDummy() GUISetState(@SW_SHOW, $hGUI) ; Set accelerators for Cursor up/down and Enter Dim $AccelKeys[3][2] = [["{UP}", $cUP], ["{DOWN}", $cDOWN], ["{ENTER}", $cENTER]] GUISetAccelerators($AccelKeys) $iCurrIndex = -1 GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cList $sChosen = GUICtrlRead($cList) If $sChosen <> "" Then GUICtrlSetData($cInput, $sChosen) Case $cButton If $sPartialData <> "" Then $sFinal = GUICtrlRead($cInput) If _ArraySearch($asFile, $sFinal) > 0 Then MsgBox(0, "Chosen", $sFinal) EndIf EndIf Case $cUP If $sPartialData <> "" Then $iCurrIndex -= 1 If $iCurrIndex < 0 Then $iCurrIndex = 0 _GUICtrlListBox_SetCurSel($cList, $iCurrIndex) EndIf Case $cDOWN If $sPartialData <> "" Then $iTotal = _GUICtrlListBox_GetCount($cList) $iCurrIndex += 1 If $iCurrIndex > $iTotal - 1 Then $iCurrIndex = $iTotal - 1 _GUICtrlListBox_SetCurSel($cList, $iCurrIndex) EndIf Case $cENTER If $iCurrIndex <> -1 Then $sText = _GUICtrlListBox_GetText($cList, $iCurrIndex) GUICtrlSetData($cInput, $sText) $iCurrIndex = -1 _GUICtrlListBox_SetCurSel($cList, $iCurrIndex) EndIf EndSwitch WEnd Func CheckInputText() $sPartialData = "|" ; Start with delimiter so new data always replaces old Local $sInput = GUICtrlRead($cInput) If $sInput <> "" Then For $i = 1 To $asFile[0] If StringInStr($asFile[$i], $sInput) <> 0 Then $sPartialData &= $asFile[$i] & "|" Next GUICtrlSetData($cList, $sPartialData) EndIf EndFunc ;==>CheckInputText Func sFile() ; Get an array of files from the desktop $asFile = _FileListToArray(@DesktopDir, "*", $FLTA_FILES) EndFunc ;==>sFile Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) ; If it was an update message from our input If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $cInput Then CheckInputText() EndIf EndFunc ;==>_WM_COMMAND M23
    1 point
  3. Simpel

    Redim Errors

    Instead of redeclaring this variable you can introduce a new variable, e.g. a bool one. Set this to False if Not Ubound() or Ubound()=0 and check against this first. And every time you enter this function set it first to True.
    1 point
  4. @price98 To make GUI easier, take a look at Koda Form Designer
    1 point
  5. price98, Welcome to the AutoIt forums. However, we do not just produce code for you - we help you get your code working properly. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. So I suggest you look at the examples in the Help file for GUICreate, GUICtrlCreateButton, GUICtrlCreateInput & GUICtrlCreateList to get your GUI started - and _FileListToArray to get the files on your desktop. Have a go at producing something yourself and then post it (see here how to do it) - even if it does not do what you require. We can then start helping you to get it working as you wish. M23
    1 point
  6. Not sure why you say it won't work any other way. RightFAX include a silent uninstall string in the registry; I have repackaged, installed, upgraded and uninstalled the product numerous times. Why try automating the GUI when you can uninstall silently?
    1 point
  7. Found some more bugs, fixed them
    1 point
  8. Another way is using Number(). MsgBox(0, "", Number("0000982"))
    1 point
  9. Exit

    Help with a numeric string

    keep it simple ! $n1 ="0000982 " $n = $n1+0 MsgBox(0,"",$n)
    1 point
  10. Melba23

    Help with a numeric string

    HockeyFan, This seems to work quite well: Global $aList[3] = [0000982, 00009082, 9082] For $i = 0 To UBound($aList) - 1 $sRet = StringRegExpReplace($aList[$i], "^0*(d+)", "$1") ConsoleWrite($sRet & @CRLF) Next SRE explanation: ^0* - Any number of zeros starting at the beginning (d+) - Capture any digits following - obviously starting from anything other than a zero Does it work for you? M23
    1 point
×
×
  • Create New...