Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/27/2019 in all areas

  1. @Melba23, I guess my action crossed yours, but I have created an official warning and given the OP 1 day to read them properly as I have been warning him multiple times now. Jos
    2 points
  2. Just for fun, a weekend script that comes from 2 ideas: one idea is from this link (https://github.com/lukePeavey/quotable), that shows how to get a single random quote from a database, The other idea is to visualize the above quotes by a revisitation of a funny snipped I posted time ago here (https://www.autoitscript.com/forum/topic/159910-useless-code/?do=findComment&comment=1163490) that very rougly simulates a "Departure Mechanical Panel". Of course you could also use an array of your own phrases to send randomly to the _AsciiPanel() function. I hope you have fun and I wish you can use this "Departure Panel" to take a nice journey toward wisdom. Global $hGuiPanel HotKeySet("{ESC}", "_End") _Example() Func _Example() Local $bError = False, $aSplit Do If GUIGetMsg() = -3 Then ExitLoop $sQuote = InetRead("https://api.quotable.io/random", 1) If Not @error Then $aSplit = StringSplit(BinaryToString($sQuote), '"', 3) $sQuote = $aSplit[7] & " (" & $aSplit[11] & ")" Else $sQuote = "Sorry, no quotes for You." $bError = True EndIf _AsciiPanel($sQuote) Until $bError EndFunc ;==>_Example Func _AsciiPanel($sMsg, $iSeconds = 8, $iColumns = 30) ; only ascii chars allowed $sMsg = StringRegExpReplace($sMsg, "[^\x20-\x7F]+", " ") $sMsg = _StringColumn($sMsg, $iColumns) Local $aAsciiLines = StringSplit($sMsg, @CR, 3) Local $iRows = UBound($aAsciiLines) Local $aPanelLines[$iRows] Local $iTotChars = $iRows * $iColumns, $iMatches = 0, $sOutput = '' ; dimensions of the GUI based on Font Courier New 48 Local $iY = $iRows * 68, $iX = $iColumns * 38.33 $hGuiPanel = GUICreate('The talking oracle', $iX, $iY) Local $hPanel = GUICtrlCreateLabel('', 0, 0, $iX, $iY) GUICtrlSetFont(-1, 48, -1, -1, "Courier New") GUISetState() For $row = 0 To $iRows - 1 $aAsciiLines[$row] = StringToASCIIArray(StringFormat("%-" & $iColumns & "." & $iColumns & "s", $aAsciiLines[$row])) $aPanelLines[$row] = StringSplit(StringTrimRight(StringReplace(StringFormat('%' & $iColumns & 's', ""), ' ', '127,'), 1), ',', 3) ; 31 Next Do $iMatches = 0 For $row = 0 To UBound($aAsciiLines) - 1 For $col = 0 To $iColumns - 1 _SetInnerArray($aPanelLines[$row], $col, ($aPanelLines[$row])[$col] - (($aPanelLines[$row])[$col] <> ($aAsciiLines[$row])[$col])) $iMatches += (($aPanelLines[$row])[$col] = ($aAsciiLines[$row])[$col]) Next $sOutput &= StringFromASCIIArray($aPanelLines[$row]) & @CRLF Next ControlSetText('', '', $hPanel, $sOutput) $sOutput = '' Sleep(10) If GUIGetMsg() = -3 Then Exit Until $iMatches = $iTotChars Local $iTimer = TimerInit() Do If GUIGetMsg() = -3 Then Exit Until TimerDiff($iTimer) > (1000 * $iSeconds) GUIDelete($hGuiPanel) EndFunc ;==>_AsciiPanel ; to sets an element of an arry (within array) Func _SetInnerArray(ByRef $aArray, $iElement, $Value) $aArray[$iElement] = $Value EndFunc ;==>_SetInnerArray ; formats a long string within a column of n. chars without splitting words Func _StringColumn($sString, $x = 20) For $i = $x To StringLen($sString) Step $x $i = StringInStr($sString, " ", 0, -1, $i) If $i = 0 Then Return SetError(1, 0, "") $sString = StringReplace($sString, $i, @CR) Next If StringRight($sString, 1) = @CR Then $sString = StringTrimRight($sString, 1) Return $sString EndFunc ;==>_StringColumn Func _End() If WinActive("[ACTIVE]") = $hGuiPanel Then GUIDelete($hGuiPanel) Exit EndIf EndFunc ;==>_End
    2 points
  3. Ebola57, Glad you like the UDF - that is why I wrote it! M23
    1 point
  4. mikell, You took the words right out of my mouth! Ebola57, Here is an example for you - you will need to play with the GUI size to exactly fill your screen: #include <GUIConstantsEx.au3> #include "GUIScrollbars_Ex.au3" $hGUI = GUICreate("Test", @DesktopWidth - 50, @DesktopHeight - 50) GUISetBkColor(0xFF0000, $hGUI) ; Create a 2000x2000 green label GUICtrlCreateLabel("", 0, 0, 2000, 2000) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 1990, 1990, 10, 10) GUICtrlSetBkColor(-1, 0x0000FF) GUISetState() ; Generate scrollbars - Yes, this is all you need to do!!!!!!!!!!!!!!!!!!!! _GUIScrollbars_Generate($hGUI, 2000, 2000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd M23
    1 point
  5. The best (and easiest) way to achieve this - using scrollbars - could be to use Melba's GuiScrollbars_Ex.au3
    1 point
  6. JLogan3o13

    ahk to autoit

    I've noticed another rash of unhelpful opinionated comments from you lately. Look through the history of this forum and you will see many times where we've helped people transition from AHK to AutoIt, as there are many here who do know both languages. If you "have no intent of learning it" great, or have nothing to actually add to a post, keep moving and let someone who does want to help do so.
    1 point
×
×
  • Create New...