Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/30/2023 in all areas

  1. Thank you, I'm glad you are interested. I have been researching this, I shouldn't have to rewrite the code, only expand, I have been building this with user modification in mind and trying to leave it as open for editing/modification as possible, and all the dimensions and specifications for graphics and such are not hard coded and instead stored in a data file. This way, in theory, I should only have to add a few If-then-else statements at the start of loading process that check for full screen and screen resolution, then based off that criteria it will refer to the proper dimensions from the data file. @DesktopHeight and @DesktopWidth will likely play a part in this, also been reading thru WinAPI stuff and other things.
    3 points
  2. @bobbiehansen Just to avoid confusion, you would be better to consider AutoIt as a scripting language, rather than as a programming language. Don't get me wrong. AutoIt is a very powerful scripting language. Some of the more advanced people here can really make it stand up, sing, and dance. (Not to mention the amazing work the developers put into it.) As such, there are limitations to what you can do to protect your source code. I think that @orbs gave you the best advice. Rather than selling your script as a "program" to your clients, go ahead and provide the "compiled" version of your script, and pitch it as a service. You can still charge a reasonable up-front cost for customizing, installing, and implementing your script, then charge them a fee for maintenance, to include bug fixes and technical support. This also provides you with an ongoing revenue stream, rather than a one-time sale.
    1 point
  3. Truthfully written in C. If you are able to create a convincing UI in C++ you can make the whole application so you don't need AutoIt.
    1 point
  4. Andreik

    Toggle Control UDF

    Here is a small UDF to create simple toggle buttons. I made this for one of my projects but I decided to make it available for those who might find it useful for their projects. It has no other dependencies except GDI+. Basically call _GDIPlus_Startup() before using any other function from this UDF and _GDIPlus_Shutdown() after you properly deleted all controls created with this UDF. Colors and sizes are customizable and there is a picture control that is associated with each toggle button so you can use other AutoIt functions with these buttons, like GUICtrlSetCursor(), GUICtrlSetTip(), etc. Here is a simple example: #include <ToggleButton.au3> _GDIPlus_Startup() $mAdminOn = GUICtrlToggle_CreateTheme(0xFF2C6E49, 0x30B5C99A, 0xFFB5C99A, 5, 2) $mAdminOff = GUICtrlToggle_CreateTheme(0xFF800F2F, 0x30F45B69, 0xFFF45B69, 5, 2) $hMain = GUICreate('Toggle Button UDF', 300, 200) GUICtrlCreateLabel('Admin mode', 10, 10, 80, 25, 0x200) ; SS_CENTERIMAGE GUICtrlSetFont(-1, 10, 500, 0, 'Segoe UI') $mHToggle = GUICtrlCreateToggle($hMain, 90, 10, 50, 25) GUICtrlSetTip(GUICtrlToggle_CtrlID($mHToggle), 'Click me') GUICtrlToggle_SetTheme($mHToggle, $mAdminOff) $mVToggle = GUICtrlCreateToggle($hMain, 200, 20, 40, 170, $TOGGLE_VERTICAL) GUICtrlSetTip(GUICtrlToggle_CtrlID($mVToggle), 'Click me multiple times') GUISetState() While True Switch GUIGetMsg() Case $mHToggle['ID'] ToggleState($mHToggle) If GUICtrlToggle_State($mHToggle) Then GUICtrlToggle_SetTheme($mHToggle, $mAdminOn) Else GUICtrlToggle_SetTheme($mHToggle, $mAdminOff) EndIf Case $mVToggle['ID'] ToggleState($mVToggle) $iSwitchSize = GUICtrlToggle_SwitchSize($mVToggle) $iSwitchSize += 1 If $iSwitchSize > 10 Then $iSwitchSize = 3 GUICtrlToggle_SwitchSize($mVToggle, $iSwitchSize) GUICtrlToggle_SwitchColor($mVToggle, 0xFF000000 + Random(0, 0xFFFFFF, 1)) Case -3 ; GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUICtrlDeleteToggle($mVToggle) GUICtrlDeleteToggle($mHToggle) _GDIPlus_Shutdown() Enjoy! Edit: added a little bit of code to detect the background color of the parent window, if it's not provided. ToggleButton.au3
    1 point
  5. water

    Toggle Control UDF

    Added to the wiki 🙂
    1 point
  6. in short, no. if a user is sophisticated and motivated enough, they will have your source code. as to how, that's beyond the scope of this forum, and naturally against the forum rules to discuss. but: what you can do is instead of selling (and halfheartedly protecting) your code, sell (and maintain) support for it. sure, they can have your code, but who's better than the author himself to provide support for it? support, may i remind, includes not only present aspects like bug fixes and user training, but also users requirements analysis, customization, feature requests, and in general - future aspects. in short, yes, and quite simply too. your AutoIt GUI can be fully customized. so, have a look at your desired expensive software - fonts, color scheme, controls layout, etc. - and mimic its appearance in your AutoIt GUI. P.S. welcome to the AutoIt forum!
    1 point
  7. What you're asking for is a bit expensive to do. The best solution to your problem is to use your AutoIt program as a background server for your other application. The two programs must communicate based on queries on the same machine. This approach is expensive in terms of system resources.
    1 point
  8. What about this? ;Coded by UEZ build 2023-10-30 ConsoleWrite(Hex(RGB(255,0,0)) & @CRLF) ConsoleWrite(Hex(ARGB(128,80,120,240)) & @CRLF) Func RGB($r, $g, $b) Return BitOR(BitShift(Max(0, Min(255, $r)), -16), BitShift(Max(0, Min(255, $g)), -8), Int(Max(0, Min(255, $b)))) EndFunc Func ARGB($a, $r, $g, $b) Return BitOR(BitShift(Max(0, Min(255, $a)), -24), BitShift(Max(0, Min(255, $r)), -16), BitShift(Max(0, Min(255, $g)), -8), Int(Max(0, Min(255, $b)))) EndFunc Func Min($a, $b) Return $a < $b ? $a : $b EndFunc Func Max($a, $b) Return $a > $b ? $a : $b EndFunc
    1 point
  9. And how it looks like a more expensive programming language? AutoIt can be changed and modified like any other application by someone who really want to. So what is your question after all?
    1 point
  10. Good day, Well,..with the assistance of ragnarok775 and Anreik, the script is now completed... Here is the completed script... Session_List_Producer.au3 Again...many, many thanks to both ragnarok775 and Anreik...and especially to Anreik!! Very much appreciated...
    1 point
  11. Nope... and when you think about it.... how would that work without any logic on what concatenation really means as I assume you like to merge that data of 2 JSON files?
    1 point
  12. maniootek, Perhaps as you are dealing with numbers, you could add an UpDown like this: #include <WindowsConstants.au3> ;$WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN #include <GUIConstantsEx.au3> ;$GUI_EVENT_CLOSE #include "GUIListViewEx.au3" ArrayEdit_Example() Func ArrayEdit_Example() Local $aHeaders[] = ["name", "surname", "age"] Local $aDataTable[][] = [ ["bill", "gates"], ["jim", "carrey"], ["morgan", "freeman"] ] Local $aEditableCols[] = [2] ArrayEdit($aDataTable, $aHeaders, $aEditableCols) _ArrayDisplay($aDataTable, "$aArrayAfterEditing") EndFunc Func ArrayEdit(ByRef $aInput, $aHeaders, $aEditableCols) Local Const $GUI_WIDTH = 600 Local Const $GUI_HEIGHT = 400 ;AutoItSetOption("GUICoordMode", default) Local $hGUI = GUICreate(Default, $GUI_WIDTH, $GUI_HEIGHT, -1, -1, -1, 8) ;$WS_EX_TOPMOST=8 Local $idListView = GUICtrlCreateListView(_ArrayToString($aHeaders), 10, 10, $GUI_WIDTH - 20, $GUI_HEIGHT - 20, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($idListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) For $i = 0 To UBound($aInput) - 1 GUICtrlCreateListViewItem(_ArrayToString($aInput, "|", $i, $i), $idListView) _GUICtrlListView_SetColumnWidth($idListView, $i, 100) Next $iLV_Index = _GUIListViewEx_Init($idListView, $aInput, 0, 0, True, 512) ;512 = No internal drag/drop Local $sEditableCols = _ArrayToString($aEditableCols, ";") _GUIListViewEx_SetEditStatus($iLV_Index, $sEditableCols, 1, 1, "1|120|1") :<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _GUIListViewEx_MsgRegister(True, False, False) GUISetState(@SW_SHOW) Local $vRet While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch _GUIListViewEx_EventMonitor() WEnd $aInput = _GUIListViewEx_ReturnArray($iLV_Index, 0) GUIDelete($hGUI) EndFunc Other than that, I made one or two cosmetic changes which you can take or leave - simply a matter of preferred coding style. M23
    1 point
  13. Here is a basic implementation to save/load playlists: ; ----------------------------------------------- #include <GuiListView.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Global $WorkingDir="E:\Master_Backup" Global $DestinationDir='G:\Session_Master\Performance' Global $PlaylistsDir = @DesktopDir ; Update it with desired directory path ; ----------------------------------------------- $hMain=GUICreate('Playlist', 500, 250) $cPlaylist=GUICtrlCreateListView('Session Files Listing', 100, 10, 425, 225, 0x0008, 0x00000020) ; LVS_SHOWSELALWAYS, LVS_EX_FULLROWSELECT $cAdd=GUICtrlCreateButton('Add', 10, 10, 80, 25) $cDelete=GUICtrlCreateButton('Delete', 10, 40, 80, 25) $cCopy=GUICtrlCreateButton('Copy', 10, 70, 80, 25) $cClear=GUICtrlCreateButton('Clear', 10, 100, 80, 25) $cSave=GUICtrlCreateButton('Save', 10, 130, 80, 25) $cOpen=GUICtrlCreateButton('Open', 10, 160, 80, 25) _GUICtrlListView_SetColumnWidth($cPlaylist, 0, 400) GUISetState(@SW_SHOW, $hMain) ; ----------------------------------------------- While True Switch GUIGetMsg() Case $cAdd AddToPlaylist($cPlaylist) Case $cDelete DeleteFromPlaylist($cPlaylist) Case $cCopy CopyFiles($cPlaylist) Case $cClear ClearPlaylist($cPlaylist) Case $cSave SavePerf($cPlaylist) Case $cOpen OpenPerf($cPlaylist) Case -3 ; GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; ----------------------------------------------- Func AddToPlaylist($cPlaylist) Local $iItem Local $sFileSelectDialog=FileOpenDialog('Select files', $WorkingDir, 'EDL Files (*txt)', 4) ; FD_MULTISELECT If @error Then Return SetError(1, 0, Null) Local $aSplit=StringSplit($sFileSelectDialog, '|') If Not IsArray($aSplit) Then Return SetError(1, 0, Null) If $aSplit[0]=1 Then $iItem=_GUICtrlListView_FindText($cPlaylist, $aSplit[1], -1, False) If $iItem=-1 Then GUICtrlCreateListViewItem($aSplit[1], $cPlaylist) Else MsgBox(0x40, 'Info', $aSplit[1] & ' is already in the playlist.') ; MB_ICONINFORMATION EndIf Else _GUICtrlListView_BeginUpdate($cPlaylist) For $Index=2 To $aSplit[0] $iItem= _GUICtrlListView_FindText($cPlaylist, $aSplit[1] & '\' & $aSplit[$Index], -1, False) If $iItem=-1 Then GUICtrlCreateListViewItem($aSplit[1] & '\' & $aSplit[$Index], $cPlaylist) Else MsgBox(0x40, 'Info', $aSplit[1] & '\' & $aSplit[$Index] & ' is already in the playlist.') ; MB_ICONINFORMATION EndIf Next _GUICtrlListView_EndUpdate($cPlaylist) EndIf EndFunc ; ----------------------------------------------- Func DeleteFromPlaylist($cPlaylist) Local $iRet=MsgBox(0x24, 'Delete', 'Do you want to delete the selected files?') ; MB_YESNO + MB_ICONQUESTION If $iRet=6 Then _GUICtrlListView_DeleteItemsSelected($cPlaylist) ; IDYES EndFunc ; ----------------------------------------------- Func CopyFiles($cPlaylist) Local $sDestination=FileSelectFolder('Select destination', $DestinationDir) If @error Then MsgBox(0x30, 'Warning', 'Destination directory has not been selected.' & @CRLF & 'Operation is canceled.') ; MB_ICONWARNING Return SetError(1, 0, Null) EndIf Local $iCount=_GUICtrlListView_GetItemCount($cPlaylist) For $Index=0 To $iCount - 1 FileCopy(_GUICtrlListView_GetItemText($cPlaylist, $Index), $sDestination) Next MsgBox(0x40, 'Operation done', 'The files from playlist has been copied to ' & $sDestination) ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Func ClearPlaylist($cPlaylist) Local $iRet=MsgBox(0x24, 'Clear', 'Do you want to clear the playlist?') ; MB_YESNO + MB_ICONQUESTION If $iRet=6 Then _GUICtrlListView_DeleteAllItems($cPlaylist) ; IDYES EndFunc ; ----------------------------------------------- Func SavePerf($cPlaylist) Local $sSave = FileSaveDialog('Save playlist', $PlaylistsDir, 'Playlist (*.mr5)', 18) ; FD_PATHMUSTEXIST + FD_PROMPTOVERWRITE If @error Then Return SetError(1, 0, Null) If StringRight($sSave, 4) <> '.mr5' Then $sSave &= '.mr5' Local $hFile = FileOpen($sSave, 2) ; FO_OVERWRITE Local $iCount=_GUICtrlListView_GetItemCount($cPlaylist) For $Index=0 To $iCount - 1 FileWriteLine($hFile, _GUICtrlListView_GetItemText($cPlaylist, $Index)) Next FileClose($hFile) MsgBox(0x40, 'Operation done', 'The playlist has been saved to ' & $sSave) ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Func OpenPerf($cPlaylist) Local $sLoad = FileOpenDialog('Open playlist', $PlaylistsDir, 'Playlist (*.mr5)', 1) ; FD_FILEMUSTEXIST If @error Then Return SetError(1, 0, Null) Local $sPlaylist = StringStripWS(FileRead($sLoad), 3) ; STR_STRIPLEADING + STR_STRIPTRAILING _GUICtrlListView_BeginUpdate($cPlaylist) _GUICtrlListView_DeleteAllItems($cPlaylist) Local $aLine = StringSplit($sPlaylist, @CRLF, 1) If IsArray($aLine) Then For $Index = 1 To $aLine[0] GUICtrlCreateListViewItem($aLine[$Index], $cPlaylist) Next EndIf _GUICtrlListView_EndUpdate($cPlaylist) MsgBox(0x40, 'Operation done', 'The playlist ' & $sLoad & ' has been loaded.') ; MB_ICONINFORMATION EndFunc ; -----------------------------------------------
    1 point
  14. Well there are different approaches but it's way better when you research by yourself and choose something appropriate with what you already have without being force to rewrite all code. I'll be watching this project since I like very much this type of games.
    1 point
  15. If you want the difference between two dates expressed in years, months, days, hours, minutes and seconds, this little _ElapsedTime() function can be useful for you. It returns an array with those results in its elements, that you can then format as you better like... (maybe it can be shorten a bit) (something similar already diascussed here.... https://www.autoitscript.com/forum/topic/206014-autoit-calculates-date/?do=findComment&comment=1483698) #include <Date.au3> Local $Start = "2020/01/01 08:00:00" ; "1962/05/02" & " " & "00:00:00" ; _NowTime(); start date Local $Stop = "2021/09/05 15:58:00" ; _NowCalc() ; _NowCalcDate() ; end date Local $aElapsed = _ElapsedTime($Start, $Stop) ; MsgBox(0, "Elapsed Time", $aElapsed[0] & " years, " & $aElapsed[1] & " months, " & $aElapsed[2] & " days, " & $aElapsed[3] & " hours, " & $aElapsed[4] & " minutes, " & $aElapsed[5] & " seconds") ConsoleWrite("Elapsed Time from " & $Start & " to " & $Stop & " : " & $aElapsed[0] & " years, " & $aElapsed[1] & " months, " & $aElapsed[2] & " days, " & $aElapsed[3] & " hours, " & $aElapsed[4] & " minutes, " & $aElapsed[5] & " seconds" & @CRLF) ; returns an array with the elapsed time between 2 dates expressed in years, months, days, hours, minutes, seconds Func _ElapsedTime($sStartDate, $sEndDate) Local Enum $iYears, $iMonths, $iDays, $iHours, $iMinutes, $iSeconds Local $aResult[6] ; $aResult[$iYears] = _DateDiff('Y', $sStartDate, $sEndDate) $aResult[$iMonths] = _DateDiff('M', _DateAdd('Y', $aResult[$iYears], $sStartDate), $sEndDate) $aResult[$iDays] = _DateDiff('D', _DateAdd('M', $aResult[$iMonths], _DateAdd('Y', $aResult[$iYears], $sStartDate)), $sEndDate) $aResult[$iHours] = _DateDiff('h', _DateAdd('D', $aResult[$iDays], _DateAdd('M', $aResult[$iMonths], _DateAdd('Y', $aResult[$iYears], $sStartDate))), $sEndDate) $aResult[$iMinutes] = _DateDiff('n', _DateAdd('h', $aResult[$iHours], _DateAdd('D', $aResult[$iDays], _DateAdd('M', $aResult[$iMonths], _DateAdd('Y', $aResult[$iYears], $sStartDate)))), $sEndDate) $aResult[$iSeconds] = _DateDiff('s', _DateAdd('n', $aResult[$iMinutes], _DateAdd('h', $aResult[$iHours], _DateAdd('D', $aResult[$iDays], _DateAdd('M', $aResult[$iMonths], _DateAdd('Y', $aResult[$iYears], $sStartDate))))), $sEndDate) Return $aResult ; [0] years; [1] months; [2] days; [3] hours; [4] minutes; [5] seconds EndFunc ;==>_ElapsedTime
    1 point
×
×
  • Create New...