-
Posts
414 -
Joined
-
Last visited
-
Days Won
2
Dan_555 last won the day on August 8 2020
Dan_555 had the most liked content!
Profile Information
-
WWW
https://127.0.0.1/
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Dan_555's Achievements
-
Dan_555 reacted to a post in a topic: 🕑 Analog Clock
-
Dan_555 reacted to a post in a topic: Help File/Documentation Issues. (Discussion Only)
-
KaFu reacted to a post in a topic: Uploaded a new version of the SciTE4AutoIt3.exe v21.316.1639.1
-
ioa747 reacted to a post in a topic: Uploaded a new version of the SciTE4AutoIt3.exe v21.316.1639.1
-
Uploaded a new version of the SciTE4AutoIt3.exe v21.316.1639.1
Dan_555 replied to Jos's topic in AutoIt Technical Discussion
One way to launch other tools while a compiled program is running would be to use a tool like this: Scite Plusbar -
Here is a new version of this script: #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=NewFile.exe #AutoIt3Wrapper_Outfile_x64=NewFile.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <String.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <EditConstants.au3> #include <GuiEdit.au3> #include <GuiButton.au3> #include <ScrollBarsConstants.au3> #include <Clipboard.au3> #include <FileConstants.au3> #include <GDIPlus.au3> Global $hImage, $Form1 Global $test[0][2], $hFile, $cmd = "", $cmdtmp, $tmptxt, $tmpinidir, $filesetting, $MouseX, $MouseY, $UseMouseX, $UseMouseY, $Edit1, $fInput Global $aArray[1] = [], $sData = "", $lastused = 0 Global $itsBitmap = 0 $cmdtmp = StringReplace($cmdlineraw, Chr(34), "") If StringLen($cmdtmp) = 2 Then If StringRight($cmdtmp, 1) = ":" Then $cmd = $cmdtmp & "\" EndIf Else If StringRight($cmdtmp, 1) <> "\" Or StringRight($cmdtmp, 1) <> "/" Then $cmd = $cmdtmp & "\" EndIf EndIf If StringLen(@ScriptDir) > 3 And StringRight(@ScriptDir, 1) <> "\" Then $tmpinidir = @ScriptDir & "\" Else $tmpinidir = @ScriptDir EndIf ;$cmd = "r:\" ;skip the readme for Debugging If StringLen($cmd) > 0 Then If Not FileExists($cmd) Then ;Check if the folder exists, display an error message if not ! DisplayReadMe(1) Exit EndIf Else $cmd = $tmpinidir EndIf Global Const $sFilePath = $tmpinidir & "NewFile.ini" $filesetting = IniRead($sFilePath, "setting", "filename", "MyNewFile") $filesetting = StringReplace($filesetting, ">", " ") ;msgbox (0,"",$filesetting) ;Debugging $UseMouseX = IniRead($sFilePath, "setting", "UseMouseX", "1") $UseMouseY = IniRead($sFilePath, "setting", "UseMouseY", "0") If FileExists($sFilePath) Then $aArray = IniReadSectionNames($sFilePath) ; Read the INI section names. This will return a 1 dimensional array. EndIf ; Check if an error occurred. If @error = 0 Then ; Enumerate through the array displaying the section names. Local $count = 0 If FileExists($sFilePath) Then For $i = 1 To $aArray[0] $tmp1 = IniRead($sFilePath, $aArray[$i], "1", "none") If $tmp1 <> "none" And StringLeft($tmp1, 1) = "." Then ;Extension need to have a dot, or it will be ignored ! $tmptxt = $tmptxt & $tmp1 & "|" & $aArray[$i] & @CRLF $count = $count + 1 ;Count how many extensions are added ! EndIf Next EndIf If $count = 0 Then $tmptxt = ".au3|AutoIt 3" & @CRLF & ".txt|Text File" & @CRLF ;MsgBox($MB_SYSTEMMODAL,"",$tmptxt) _ArrayAdd($test, $tmptxt, 0, "|", @CRLF) Else ;Reading the ini failed, create a default array for the extensions $tmptxt = ".au3|AutoIt 3" & @CRLF & ".txt|Text" & @CRLF _ArrayAdd($test, $tmptxt, 0, "|", @CRLF) EndIf ;Local $test[5][2] = [['.au3', 'AutoIt'], ['.ahk', 'Auto Hotkey'], ['.txt', 'text'], ['.sdlbas', 'Sdl Basic'], ['.html', 'Webpage']] If $UseMouseX = 1 Then $MouseX = MouseGetPos(0) Else $MouseX = -1 EndIf If $UseMouseY = 1 Then $MouseY = MouseGetPos(1) Else $MouseY = -1 EndIf ;Check if the Clipboard contains an image/picture If _ClipBoard_IsFormatAvailable($CF_BITMAP) Then $itsBitmap = 1 $Form1 = GUICreate("Create New File", 210 + ($itsBitmap * 220), 247, $MouseX, $MouseY, $WS_CAPTION, $WS_EX_APPWINDOW) $List = GUICtrlCreateListView("", 5, 5, 200, 199) ;GUICtrlCreateLabel("Example:" & $filesetting & "0000.ext", 5, 205) $fInput = GUICtrlCreateInput($filesetting, 5, 206, 201, 18) $BTN_OK = GUICtrlCreateButton("Ok", 3, 224, 30, 22) $BTN_SaveCT = GUICtrlCreateButton("Save Clip Text", 33, 224, 75, 22) $BTN_ReadMe = GUICtrlCreateButton("ReadMe", 108, 224, 55, 22) $BTN_Cancel = GUICtrlCreateButton("Cancel", 163, 224, 45, 22) $cDummy = GUICtrlCreateDummy() GUISetState(@SW_SHOW) If $itsBitmap = 1 Then $BTN_SavePNG = GUICtrlCreateButton("PNG", 260, 224, 45, 22) $BTN_SaveJPG = GUICtrlCreateButton("JPG", 305, 224, 45, 22) $BTN_SaveBMP = GUICtrlCreateButton("BMP", 350, 224, 45, 22) _GDIPlus_Startup() ClipDrawBitmap() EndIf _GUICtrlListView_BeginUpdate($List) _GUICtrlListView_InsertColumn($List, 0, "Extension", 65) _GUICtrlListView_InsertColumn($List, 1, "Description", 115) _GUICtrlListView_AddArray($List, $test) $lastused = IniRead($sFilePath, "setting", "lastused", "0") If $lastused > _GUICtrlListView_GetItemCount($List) Then $lastused = 0 _GUICtrlListView_SetItemSelected($List, Int($lastused), True, True) _GUICtrlListView_EndUpdate($List) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Local $aFormats[3] = [2, $CF_TEXT, $CF_OEMTEXT] Local $tmpsaveit=0 While 1 $nMsg = GUIGetMsg() Local $tmptxt = StringSplit(_GUICtrlListView_GetItemTextString($List), "|")[1] If @error = 1 Then $tmptxt = "" If StringLen($tmptxt) > 0 Then _GUICtrlButton_Enable($BTN_OK, 1) If _ClipBoard_GetPriorityFormat($aFormats) > 0 Then _GUICtrlButton_Enable($BTN_SaveCT, 1) Else _GUICtrlButton_Enable($BTN_SaveCT, 0) EndIf Else _GUICtrlButton_Enable($BTN_SaveCT, 0) _GUICtrlButton_Enable($BTN_OK, 0) EndIf For $x = 0 To _GUICtrlListView_GetItemCount($List) If _GUICtrlListView_GetItemSelected($List, $x) = True Then $lastused = $x ExitLoop 1 EndIf Next Switch $nMsg Case $GUI_EVENT_RESIZED, $GUI_EVENT_RESTORE, $GUI_EVENT_MAXIMIZE ReDrawBitmap() Case $GUI_EVENT_CLOSE, $BTN_Cancel ExitLoop Case $BTN_ReadMe DisplayReadMe(0) Case $BTN_OK, $cDummy If StringLen($tmptxt) > 0 Then $tmpfile = GetFreeFileName() If $tmpfile <> "" Then $hFile = _WinAPI_CreateFile($tmpfile, 0) _WinAPI_CloseHandle($hFile) IniWrite($sFilePath, "setting", "lastused", $lastused) ExitLoop ;End the program EndIf EndIf Case $BTN_SaveCT If StringLen($tmptxt) > 0 Then $tmpfile = GetFreeFileName() ConsoleWrite($tmpfile) If $tmpfile <> "" Then $hFile = FileOpen($tmpfile, 17) Local $sData = ClipGet() For $x = 1 To StringLen($sData) Local $tmpwtxt = StringMid($sData, $x, 1) FileWrite($hFile, StringToBinary($tmpwtxt)) FileSetPos($hFile, $x, 0) Next FileClose($hFile) IniWrite($sFilePath, "setting", "lastused", $lastused) ExitLoop ;End the program EndIf EndIf EndSwitch If $itsBitmap = 1 Then Switch $nMsg Case $BTN_SaveBMP $tmpfile = GetFreeFileName(1) $tmpsaveit=1 ConsoleWrite($tmpfile & @CRLF) ExitLoop Case $BTN_SavePNG $tmpfile = GetFreeFileName(2) $tmpsaveit=1 ConsoleWrite($tmpfile & @CRLF) ExitLoop Case $BTN_SaveJPG $tmpfile = GetFreeFileName(3) $tmpsaveit=1 ConsoleWrite($tmpfile & @CRLF) ExitLoop EndSwitch EndIf WEnd If $itsBitmap = 1 Then if $tmpsaveit=1 then _GDIPlus_ImageSaveToFile($hImage,$tmpfile) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndIf Func GetFreeFileName($format = 0) Local $fnr = 0, $tmpfile = "", $tmpfile1 = "" , $a=0, $b=0 Local $tmpread = GUICtrlRead($fInput), $fc = 0 If $format > 0 Then $tmptxt = StringMid(".BMP.PNG.JPG", ($format * 4) - 3, 4) ;Check for invalid characters if user entered a custom file name If $tmpread <> $filesetting And StringLen($tmpread) > 0 Then $filesetting = $tmpread Local $invalidfnamechars = ':*/\?"<>' For $x = 1 To StringLen($invalidfnamechars) $filesetting = StringReplace($filesetting, StringMid($invalidfnamechars, $x, 1), "") Next $fc = 1 EndIf If $fc = 1 Then ;No invalid characters ;check if the user has entered a custom extension, but skip the check for picture formats If $format = 0 Then $a = StringInStr($filesetting, ".", 2, -1) $b = StringLen($filesetting) EndIf If $b - $a > 0 Then ;do not add the extension $tmpfile1 = $cmd & $filesetting Else ;add the extension $tmpfile1 = $cmd & $filesetting & $tmptxt EndIf ;fallback case if the file exist If FileExists($tmpfile1) Then $fc = 0 EndIf If $fc = 0 Then While $fnr < 10000 $tmpfile = $cmd & $filesetting & _StringRepeat("0", 4 - StringLen($fnr)) & $fnr & $tmptxt ;MsgBox(0,"",$tmpfile) ; for debugging If Not (FileExists($tmpfile)) Then $tmpfile1 = $tmpfile ExitLoop EndIf $fnr = $fnr + 1 WEnd EndIf Return $tmpfile1 EndFunc ;==>GetFreeFileName ;================================================================================ Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $List If Not IsHWnd($List) Then $hWndListView = GUICtrlGetHandle($List) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK ; Fire the dummy if the ListView is double clicked GUICtrlSendToDummy($cDummy) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func DisplayReadMe($err) Local $Form1 = GUICreate("Read Me", 550, 400, 10, 10, BitOR($WS_CAPTION, $WS_THICKFRAME, $WS_MAXIMIZEBOX)) $Edit1 = GUICtrlCreateEdit("", 0, 0, 549, 399) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) If $err = 1 Then Local $txttmp01 = "Error: Path does not exist" Local $txttmp02 = "Commandline call was: " AddText($txttmp01) AddText($txttmp02 & $cmd & @CRLF & @CRLF) EndIf AddText("Instructions:" & @CRLF) AddText("Displays a selection of available extensions and then creates a new file at the Path's location." & @CRLF & @CRLF & "Usage: NewFile Path") AddText("Example: NewFile c:\myfolder\" & @CRLF) AddText("Result: A file with a name 'MyFile0000.ext' will be created at the Path's location.") AddText("If the filename exists, the number counter will increase, until it finds a free number, up to 9999." & @CRLF) AddText("You can change the filename in the input field. If the filename does not exists, it will be saved." & @CRLF) AddText("Now you can enter a custom name and extension. If the filename does exists, numbers will be added at the end of the filename." ) AddText("P.S. You can not add custom extension as the new name, because by clicking on the save picture buttons, the extension will be automatically set to either PNG, BMP or JPG." & @CRLF) AddText("If the filename from the input field exists, the numbers (0000-9999) will be added." & @CRLF) AddText("Use Save Clip button to copy the Clipboard text content into the file !" & @CRLF) AddText("OK + save clip buttons are clickable, only when an extension is selected. Save Clip needs (additionally) to have text data in the clipboard." & @CRLF ) AddText("If the clipboard contains a bitmap image, it will be displayed in a larger window and with additional buttons. You can save the picture by clicking on the desired format." & @CRLF) AddText("Uses a configuration file in the .exe folder named NewFile.ini !" & @CRLF) AddText("Example of a config file:" & @CRLF) AddText("[setting]" & @CRLF & "filename=MyFile>") AddText("UseMouseX=0 ;0 or 1 - position the dialog at the mouse x coordinate - usefull for multi monitor settings !") AddText("UseMouseY=0 ;0 or 1 - Set this and UseMouseX to spawn the dialog at the mouse coordinates !" & @CRLF) AddText(";Use > in filename as a space char ! (only needed if you want the space char at the beginning or at the end : in between filename and the number)" & @CRLF) AddText(";Format for this ini file is:" & @CRLF & ";Name e.g [Auto It]") AddText(";extension e.g 1=.au3" & @CRLF & "; p.s. only 1 extension per section ! the number must be 1" & @CRLF) AddText("[AutoIt3]" & @CRLF & "1=.au3" & @CRLF & @CRLF & "[Text]" & @CRLF & "1=.txt") _GUICtrlEdit_SetSel($Edit1, 0, 0) _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET) If $err = 1 Then _GUICtrlEdit_SetSel($Edit1, 0, StringLen($txttmp01 & $txttmp02 & $cmd) + 5) EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($Form1) ExitLoop EndSwitch WEnd EndFunc ;==>DisplayReadMe Func AddText($edittxt) _GUICtrlEdit_AppendText($Edit1, $edittxt & @CRLF) EndFunc ;==>AddText Func ReDrawBitmap() $WPos = WinGetPos($Form1) $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) _GDIPlus_DrawImagePoints($hGraphics, $hImage, 209, 5, $WPos[2]-8, 5, 209, $WPos[3] - 53) _GDIPlus_GraphicsDispose($hGraphics) EndFunc ;==>ReDrawBitmap Func ClipDrawBitmap() Local $hBitmap, $hGraphics _ClipBoard_Open($Form1) $hBitmap = _ClipBoard_GetDataEx($CF_BITMAP) _ClipBoard_Close() If $hImage > 0 Then _GDIPlus_ImageDispose($hImage) If $hBitmap > 0 Then $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) _WinAPI_DeleteObject($hBitmap) ReDrawBitmap() EndIf EndFunc ;==>ClipDrawBitmap In this version, if there is a picture in the Clipboard, the window will be larger and the picture will be displayed. You can save the picture by clicking on the one of the tree buttons: PNG, JPG or BMP. Unlike the SaveClipText button, the picture is not updated 'on the fly'. Whichever picture is in the clipboard by the start of the app will be saved to the disk. Now you can use a custom filename+extension to create a new file. If there is a dot in the filename, the text after it (to the right side) will be used as extension. (in case of multiple dots in the filename e.g. "test.me.now" the extension .now will be used) If the last letter is a dot, the selected extension from the list will be used.
-
Danyfirex reacted to a file: SChip8 for AutoIt
-
Thanks. The main reason why i have put the opposite colors as the foreground color is to see when the text becomes visible and thus having some kind of an idea on which "distance" number would be ok to use. In my version of the Chip8 emulator, you are able to select colors. So i have, accidentally selected the same color and thus the game was not visible anymore. So i had the idea to first check if the color is the same (like both 0x000000) and to reset the colors to the default value. But this approach would not count for the colors that are very similar like 0x000000 and 0x000001, which is , while technically not the same color, it is hardly distinguishable from each other. Therefore i have tried to invent some kind of 'distance' measurement.
-
argumentum reacted to a post in a topic: Dan's misc. Scripts
-
Here is my latest script: Color Selector and a simple color distance calculation. #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #Region ### START Koda GUI section ### Form= #NoTrayIcon $color1="" $color2="" _TwoColorSelection($color1,$color2) ConsoleWrite ($color1 & " / " & $color2 & @CRLF) Exit Func _TwoColorSelection(ByRef $col1, ByRef $col2) Local $upd=1, $tmp Local $SL[6][2] Local $ColorForm1 = GUICreate("Color Selector:", 323, 302, -1, -1) For $x=0 to 2 $SL[$x][0] = GUICtrlCreateSlider(8+($x*46), 14, 31, 208, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_VERT)) GUICtrlSetLimit(-1, 255, 0) $SL[$x+3][0] = GUICtrlCreateSlider(187+($x*46), 14, 31, 208, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_VERT)) GUICtrlSetLimit(-1, 255, 0) Next GUICtrlCreateLabel("R G B", 14, 3, 128, 15) GUICtrlCreateLabel("R G B", 192, 3, 128, 15) Local $BTNCOLL = GUICtrlCreateButton("@@##TEST##@@", 8, 225, 124, 30) Local $BTNCOLR = GUICtrlCreateButton("@@##TEST##@@", 187, 224, 127, 30) Local $InpLeftH = GUICtrlCreateInput("", 24, 260, 84, 16, 9) ;9 = Centered + Uppercase Local $InpRightH = GUICtrlCreateInput("", 207, 260, 84, 16, 9) ;9 = Centered + Uppercase Local $InpLeft = GUICtrlCreateInput("", 24, 279, 84, 16, 9) ;9 = Centered + Uppercase Local $InpRight = GUICtrlCreateInput("", 207, 279, 84, 16, 9) ;9 = Centered + Uppercase GUICtrlCreateLabel("Distance:", 135, 255, 44, 24) Local $labelDistance = GUICtrlCreateLabel("", 134, 270, 64, 24) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() $SL="" Return ;Case $SL[0][0], $SL[1][0], $SL[2][0], $SL[3][0], $SL[4][0], $SL[5][0] ;Probably not needed because of the loop ; $upd=1 EndSwitch For $x=0 to 5 ;Check if the sliders have been changed with keyboard or mousewheel movement $tmp=GuiCtrlRead($SL[$x][0],2) if $SL[$x][1]<>$tmp then $upd=1 $SL[$x][1]=$tmp ExitLoop EndIf Next If $upd=1 Then Local $1R = 255 - GUICtrlRead($SL[0][0], 2), $1G = 255 - GUICtrlRead($SL[1][0], 2), $1B = 255 - GUICtrlRead($SL[2][0], 2) Local $2R = 255 - GUICtrlRead($SL[3][0], 2), $2G = 255 - GUICtrlRead($SL[4][0], 2), $2B = 255 - GUICtrlRead($SL[5][0], 2) Local $1RH = Hex($1R, 2), $1GH = Hex($1G, 2), $1BH = Hex($1B, 2) Local $2RH = Hex($2R, 2), $2GH = Hex($2G, 2), $2BH = Hex($2B, 2) $color1=$1RH & $1GH & $1BH $color2=$2RH & $2GH & $2BH GUICtrlSetData($InpLeftH, $color1) GUICtrlSetData($InpRightH, $color2 ) GUICtrlSetData($InpLeft, $1R & "," & $1G & "," & $1B) GUICtrlSetData($InpRight, $2R & "," & $2G & "," & $2B) GUICtrlSetBkColor($BTNCOLL, "0X" & $1RH & $1GH & $1BH) GUICtrlSetBkColor($BTNCOLR, "0X" & $2RH & $2GH & $2BH) GUICtrlSetColor($BTNCOLR, "0X" & $1RH & $1GH & $1BH) GUICtrlSetColor($BTNCOLL, "0X" & $2RH & $2GH & $2BH) $CD = CalculateColorDistance(GUICtrlRead($InpLeftH), GUICtrlRead($InpRightH)) GUICtrlSetData($labelDistance, $CD & " 0x" & Hex($CD, 4)) $upd=0 EndIf WEnd EndFunc ;==>_ColorSelection Func CalculateColorDistance($RGB1 = "000000", $RGB2 = "FFFFFF") ;Format RGB as hex string If IsString($RGB1) = 1 Then $RGB1 = StringReplace($RGB1, "0x", "") Else $RGB1=Hex($RGB1,6) EndIf If IsString($RGB2) = 1 Then $RGB2 = StringReplace($RGB2, "0x", "") Else $RGB2=Hex($RGB2,6) EndIf If StringLen($RGB1) < 6 Then Return -1 If StringLen($RGB2) < 6 Then Return -1 If StringLen($RGB1) > 6 Then $RGB1 = StringRight($RGB1, 6) ;Assuming the ARGB format If StringLen($RGB2) > 6 Then $RGB2 = StringRight($RGB2, 6) ;Assuming the ARGB format Local $1R = Int("0x" & StringMid($RGB1, 1, 2)), $1G = Int("0x" & StringMid($RGB1, 3, 2)), $1B = Int("0x" & StringMid($RGB1, 5, 2)) Local $2R = Int("0x" & StringMid($RGB2, 1, 2)), $2G = Int("0x" & StringMid($RGB2, 3, 2)), $2B = Int("0x" & StringMid($RGB2, 5, 2)) ;$DR = $1R - $2R ;$DG = $1G - $2G ;$DB = $1B - $2B Return Int(Abs($1R - $2R) + Abs($1G - $2G) + Abs($1B - $2B)) EndFunc ;==>CalculateColorDistance The distance calculations is very basic. Provide 2 color values in RGB format (e.g. "FF10FF" or 0x12FCD4). Each pair of R,G and B values is first substracted then the distance is calculated by adding them. As an extra feature: The color values are calculated even when the slider is changed by the mouse wheel (or arrow keys).
-
Your code does not work because you are not reading the input field for the number in the loop.
-
Please post a code with the needed gui elements ... something that we can copy/paste and run to see what is not going ok. something like this: GUICreate("hi", 320, 200) $ClassNumber = GUICtrlCreateInput("1", 1, 1, 30, 30) GUISetState() Global $ok2 = True Global $ok3 = True MsgBox(0, '$ok2', $ok2) MsgBox(0, '$ok3', $ok3) While $ok2 While $ok3 Global $nbclass = Number(GUICtrlRead($ClassNumber)) If $nbclass Then MsgBox(0, '', 'class ok' & @crlf & $nbclass & @CRLF & "Is it a number: " & IsNumber($nbclass) & @crlf & "Is it an integer: " & IsInt($nbclass)) $ok2 = False Else MsgBox(0, 'ERROR', "Class number must be one number.") $ok2 = False ;ExitLoop EndIf WEnd WEnd
-
Dan_555 reacted to a post in a topic: Shell Application Bar
-
Dan_555 reacted to a post in a topic: Retro fullscreen console with custom programming language!
-
Dan_555 reacted to a post in a topic: MiniMark (a minimalistic rtf editor)
-
Dan_555 reacted to a post in a topic: richedit streamtofile adds newline every time
-
The colors that you need to provide is in this format: Alpha, blue, green, red _GUICtrlRichEdit_SetCharColor($edit, 0x0000ff00)) you can read it in the help file of _GUICtrlRichEdit_SetCharColor under remarks: "If you need to create a COLORREF value from an color array use _ColorSetCOLORREF() not _ColorSetRGB()." As for the font, maybe try this solution ? :
-
What causes an AutoIt app to "beep"
Dan_555 replied to Fritterandwaste's topic in AutoIt General Help and Support
I had that problem while programming the chip 8 emulator. Basically whenever a button has focus and you press a key that does do nothing, a warning sound is played. If you open the windows 10 sound settings at the top right hand side there will be a related setting: "Sound Control Panel" There click on sounds and in program events search the default beep. It is this sound that plays. (or open the commandline or press Win R and launch mmsys.cpl ) -
manpower reacted to a post in a topic: System Up Time in AM / PM
-
If the @hour returns following: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 then, probably, you should use =>0
-
[HELP] REMOVE REPEATING THE EXE NAME IN ListView
Dan_555 replied to angel83's topic in AutoIt General Help and Support
if IsArray($g_aFileList) then Local $atmp[1][3] EndIf for $i=0 to UBound($g_aFileList)-1 $in=0 for $j=0 to UBound($atmp)-1 if $g_aFileList[$i][1]=$atmp[$j][1] then $in=$in+1 Next if $in=0 then $atmp[UBound($atmp)-1][0] = UBound($atmp) $atmp[UBound($atmp)-1][1] = $g_aFileList[$i][1] $atmp[UBound($atmp)-1][2] = $g_aFileList[$i][2] if $i<UBound($g_aFileList)-3 Then _ArrayAdd($atmp,"") EndIf Next _GUICtrlListView_AddArray($hListView, $atmp) EndFunc ;==>_AddSelectFolder I think this should do it, insert and replace the code after _GUICtrlListView_DeleteAllItems($hListView) in the _AddSelectFolder function. p.s. at least it works the 1st time the add button is clicked ... -
argumentum reacted to a post in a topic: Autoit sometimes freezes when polling StdOutRead
-
Netol reacted to a post in a topic: how update combo automatically after change a value
-
-
- chip8
- superchip8
-
(and 2 more)
Tagged with:
-
Dan_555 reacted to a post in a topic: Resizable & Dragable Windows Controls
-
how update combo automatically after change a value
Dan_555 replied to Netol's topic in AutoIt General Help and Support
This would add typed items into the combo box whenever something is typed/pasted after a certain amount of time. The timer starts new whenever the data is different, and when it runs out, it writes the data into the combo box. Currently i have set the timer on 2 seconds. I took the base code from https://www.autoitscript.com/forum/topic/190196-add-element-in-a-combobox-if-its-not-in-the-combobox-data/ and added the timing functions. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> ; Create a Global variable to hold the combo data Global $sComboData = "" Global $hGui, $Cco, $cAdd $hGui = GUICreate("test ", 250, 100, -1, -1, $GUI_SS_DEFAULT_GUI) ; Create combo and load with saved data $Cco = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($Cco, $sComboData) ; Create a button to add new data $cAdd = GUICtrlCreateButton("Add", 10, 50, 80, 30) GUISetState() $oldC = GUICtrlRead($Cco) $Ctimer = TimerInit() $ccw = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $cAdd ; Add new data to the combo _AddComboData() $oldC = GUICtrlRead($Cco) $ccw = 0 Case $Cco ; Just to show that the data is selectable $ccw = 0 $oldC = GUICtrlRead($Cco) ConsoleWrite("Selected " & $oldC) EndSwitch If $oldC <> GUICtrlRead($Cco) Then $oldC = GUICtrlRead($Cco) ConsoleWrite("Data is different" & @CRLF) $Ctimer = TimerInit() $ccw = 1 EndIf If TimerDiff($Ctimer) > 2000 Then If $ccw > 0 Then ConsoleWrite("Writing data to the combo box" & @CRLF) _AddComboData() $oldC = GUICtrlRead($Cco) $ccw = 0 EndIf EndIf WEnd Func _AddComboData() ; Read the content of the combo edit $sComboSel = GUICtrlRead($Cco) ; Check if in saved data If Not StringInStr($sComboData, "|" & $sComboSel) Then ; If not then add to saved data and load into the combo $sComboData &= "|" & $sComboSel GUICtrlSetData($Cco, $sComboData) EndIf EndFunc ;==>_AddComboData -
Add (On_close_Secondary()) to the On_Button2a() function, something like this: Func On_Button2a() ;at the end of the hotkey code add this: On_Close_Secondary() EndFunc ;==>On_Button2a It will close the secondary gui after the hotkey is set.
-
This is a mix of few scripts found here on the forum. What does it do ? - It is a Font Preview App. It has a Big Label, Normal Label, Edit box, Input box, Resizable Input box and a Big Button. - All of these are filled with a text. The script takes a list of fonts (although there are some missing like Terminal ... which you can type in the font name box) and applies the font with the settings to the above controls - On The Fly. You can see the result immediately. The Input box on the bottom right side holds the AutoIt ready command. If you click on the "Remember font", this setting will be saved (and added to the edit box above it). You can copy the text from the edit box, but conveniently, this app will Copy all the "Remembered" font commands and copy it to the clipboard. (There should be no duplicate entries) ;modified version of this script: https://www.autoitscript.com/forum/topic/52677-font-selector/?do=findComment&comment=398585 ;mixed with (and modified) https://www.autoitscript.com/forum/topic/202989-enumerating-fonts/?do=findComment&comment=1458177 #include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #include <WinAPIGdi.au3> #include <GuiEdit.au3> $hGui = GUICreate("Font", 640, 252, 0, 0, $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $WS_THICKFRAME) Global $aWeight[][] = [["$FW_DONTCARE", 0], ["$FW_THIN", 100], ["$FW_EXTRALIGHT", 200], ["$FW_LIGHT", 300], ["$FW_NORMAL", 400], ["$FW_MEDIUM", 500], ["$FW_SEMIBOLD", 600], ["$FW_BOLD", 700], ["$FW_EXTRABOLD", 800], ["$FW_HEAVY", 900]] Opt("GUIResizeMode", 1) $fontlist = _FontGetList(0) _ArrayDelete($fontlist, 0) $aEnumFont = EnumFontTree() For $i = 1 To UBound($aEnumFont) - 1 _ArrayAdd($fontlist, $aEnumFont[$i]) Next $aEnumFont="" ;Free the Array $fontlist = _ArrayUnique($fontlist) _ArrayDelete($fontlist, 0) _ArraySort($fontlist) $fontselect = GUICtrlCreateCombo("Arial", 0, 200, 215, 20) For $i = 0 To UBound($fontlist) - 1 GUICtrlSetData($fontselect, $fontlist[$i], "Arial") Next $fontlist="" ;Free the Array $fontsize = GUICtrlCreateCombo("2", 216, 200, 45, 20) GUICtrlSetData($fontsize, "4|5|6.5|7|7.5|8|8.5|9|9.5|10|10.5|11|11.5|12|12.5|14|14.5|16|16.5|18|18.5|20|20.5|22|22.5|24|24|26|28|30|32|36|48|72", "10") $fontstyle = GUICtrlCreateCombo("Normal", 262, 200, 75, 20) GUICtrlSetData($fontstyle, "Italic|Underline|Strike", "Normal") $weight = GUICtrlCreateCombo("", 233, 179, 103, 20) $setfont = GUICtrlCreateButton("Test Font123", 233, 0, 103, 45) $edit = GUICtrlCreateEdit("", 339, 0, 300, 193) $label = GUICtrlCreateLabel("", 0, 0, 230, 193) $input = GUICtrlCreateInput("Font Test123", 233, 46, 103, 45) $inputSmall = GUICtrlCreateInput("Font Test123", 233, 93, 103, 20) GUICtrlSetResizing(-1, $GUI_DOCKSIZE) $labelSmall = GUICtrlCreateLabel("Font Test123", 233, 117, 103, 20) GUICtrlSetResizing(-1, $GUI_DOCKSIZE) $usefont = GUICtrlCreateButton("Remember font", 233, 150, 103, 22) GUICtrlSetTip($usefont, "Adds the definition into a variable and to the edit box! " & @CRLF & "The variable will be copied into clipboard at the end of the program", "Info:") $output = GUICtrlCreateInput("", 340, 200, 298, 20) GUICtrlSetBkColor($label, 0xff00ff) GUISetState() $tmp = "" $tmp = $tmp & "ABCDEFGHIJLKMNOPQRSTUVWYYZ" $tmp = $tmp & "ÜÄÖßüäöß" & @CRLF $tmp = $tmp & "abcdefghijlkmnopqrstuvwyyz" & @CRLF $tmp = $tmp & "1234567890!§$%&/()=?`|_-,<>|@^" & @CRLF $tmp = $tmp & "******************************" & @CRLF $tmp = $tmp & "* * * *" & @CRLF $tmp = $tmp & "* *" & @CRLF $tmp = $tmp & "******************************" & @CRLF For $x = 1 To 255 $tmp1 = "" If Mod($x, 30) = 1 Then $tmp1 = @CRLF $tmp = $tmp & Chr($x) & $tmp1 Next GUICtrlSetData($label, $tmp & @CRLF) GUICtrlSetData($edit, $tmp & @CRLF) $tmp = "" $tmp1 = "" For $x = 0 To UBound($aWeight) - 1 $tmp1 = "|" If $x = UBound($aWeight) - 1 Then $tmp1 = "" $tmp = $tmp & $aWeight[$x][0] & $tmp1 Next GUICtrlSetData($weight, $tmp, $aWeight[4][0]) Local $diffFSize = -1, $diffSel, $diffAttr, $diffWe, $changed = 0 Local $ClipboardText[0] Do $msg3 = GUIGetMsg() If $diffFSize <> GUICtrlRead($fontsize) Then $changed = 1 If $diffSel <> GUICtrlRead($fontselect) Then $changed = 1 If $diffAttr <> GUICtrlRead($fontstyle) Then $changed = 1 If $diffWe <> GUICtrlRead($weight) Then $changed = 1 If $changed = 1 Then If GUICtrlRead($fontstyle) = "Normal" Then $attribute = 0 ElseIf GUICtrlRead($fontstyle) = "Italic" Then $attribute = 2 ElseIf GUICtrlRead($fontstyle) = "Underline" Then $attribute = 4 ElseIf GUICtrlRead($fontstyle) = "Strike" Then $attribute = 8 EndIf $diffFSize = GUICtrlRead($fontsize) $diffSel = GUICtrlRead($fontselect) $diffAttr = GUICtrlRead($fontstyle) $diffWe = GUICtrlRead($weight) $tmp = "" For $x = 0 To UBound($aWeight) - 1 If $aWeight[$x][0] = $diffWe Then $tmp = $aWeight[$x][1] ExitLoop EndIf Next GUICtrlSetFont($edit, $diffFSize, $tmp, $attribute, $diffSel) GUICtrlSetFont($setfont, $diffFSize, $tmp, $attribute, $diffSel) GUICtrlSetFont($label, $diffFSize, $tmp, $attribute, $diffSel) GUICtrlSetFont($input, $diffFSize, $tmp, $attribute, $diffSel) GUICtrlSetFont($inputSmall, $diffFSize, $tmp, $attribute, $diffSel) GUICtrlSetFont($labelSmall, $diffFSize, $tmp, $attribute, $diffSel) GUICtrlSetData($output, "GuiCtrlSetFont ($id," & $diffFSize & "," & $diffWe & "," & $attribute & "," & $diffSel & ")") $changed = 0 EndIf If $msg3 = $usefont Then $tmp = GUICtrlRead($output) _ArrayAdd($ClipboardText, $tmp) _GUICtrlEdit_AppendText($edit, $tmp & @CRLF) EndIf Until $msg3 = $GUI_EVENT_CLOSE If IsArray($ClipboardText) And UBound($ClipboardText) > 0 Then $ClipboardText = _ArrayUnique($ClipboardText) _ArrayDelete($ClipboardText, 0) _ArrayToClip($ClipboardText, @CRLF) EndIf GUIDelete($hGui) Exit ;=============================================================================== ; Function Name: _FontGetList() ; Description: Returns an array with a list of all fonts currently installed on the system. ; Parameter(s): $i_opt - An Integer, 0 or 1. 0 will create a 1D array with font names only. ; 1 will create a 2d array with font names in the first column, font file names in the second ; Requirement(s): None ; Return Value(s): 1D-2D Array = [0] or [0][0] Contains total number of fonts. ; Author(s): Simucal <[email protected]> ; Revision: 20060501A ; ;=============================================================================== Func _FontGetList($i_opt = 0) Dim $a_FontNames[1], $a_FontNamesFiles[1][1], $i = 1 If @OSType = "WIN32_NT" Then $regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" If @OSType = "WIN32_WINDOWS" Then $regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts" While 1 $s_temp = RegEnumVal($regkey, $i) If @error <> 0 Then ExitLoop $s_temp2 = RegRead($regkey, $s_temp) $s_temp = StringRegExpReplace($s_temp, "\s\(.*?\)(\s*)?", "") If $i_opt = 0 Then ReDim $a_FontNames[($i + 1)] $a_FontNames[$i] = $s_temp ElseIf $i_opt = 1 Then ReDim $a_FontNames[($i + 1)] $a_FontNames[$i] = $s_temp & "|" & $s_temp2 EndIf $i = $i + 1 WEnd If $i_opt = 0 Then _ArraySort($a_FontNames) $a_FontNames[0] = (UBound($a_FontNames) - 1) Return ($a_FontNames) ElseIf $i_opt = 1 Then _ArraySort($a_FontNames) ; Sort with font names and files as a single array For $i = 1 To (UBound($a_FontNames) - 1) ; then split it up into 2D, so they will be alphabatized together. $s_fontsplit = StringSplit($a_FontNames[$i], "|") If IsArray($s_fontsplit) = 1 Then ReDim $a_FontNamesFiles[($i + 1)][2] $a_FontNamesFiles[$i][0] = $s_fontsplit[1] $a_FontNamesFiles[$i][1] = $s_fontsplit[2] EndIf Next $a_FontNamesFiles[0][0] = (UBound($a_FontNamesFiles) - 1) Return ($a_FontNamesFiles) EndIf EndFunc ;==>_FontGetList Func EnumFontTree() Local $font_list = _WinAPI_EnumFontFamilies(0, "", "", -1, "@*", True) _ArraySort($font_list, 0, 1, 0, 0) Local $font_tree[1] $i = 1 While ($i <= $font_list[0][0]) $tmp = $font_list[$i][0] _ArrayAdd($font_tree, $tmp) $i = $i + 1 WEnd Return $font_tree EndFunc ;==>EnumFontTree