Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/13/2015 in all areas

  1. I very very rarely use anything in Misc.au3, and even rarer use anything other than _ArrayDisplay in Array.au3
    3 points
  2. JohnOne

    Require a Serial

    This is a very very basic example of how to make your program require a serial number. Your serial number can be most anything you like within reason, it will be encrypted. The crypted serial for this basic example will be inside your program. if you want to use this examples serial it is "my serial" It works like this. 1. Your program looks at a registry key value. 2. if the value does not exist or is wrong, the user will be asked for a serial. 3. if serial is correct, the regkey and value will be written to the registry and user will not be asked again because the next time they run it, the key and value will be there. 4. if serial is wrong, the program simply exits with a message. This is a simple example and not intended to protect your program from attack/hack or anything else. You should always be aware that the registry is used by your operating system, and is not to be played with. Example using registry method Here is an even more basic example using a folder existence method.
    1 point
  3. kcvinu, And why do you suppose that is the case? Perhaps this might give you a clue. And there has always been a reluctance to take further functions into core code as we get enough complaints about the size of the "compiled" executables as it is without further increasing the size of the interpreter which is packaged with each one. M23
    1 point
  4. Hylia, if you use GUICtrlCreatePic to create a control to hold the image you can do exactly what you have suggested. M23
    1 point
  5. Gift from me: https://www.autoitscript.com/forum/topic/139260-autoit-snippets/?do=findComment&comment=1264752 TD
    1 point
  6. AutoIt is boss. It can do anything if you make it do it. Including embedding AutoIt functions internally. Though it wouldn't be too hard to translate AutoIt to C++ -- because all AutoIt internal functions are already there after all. =)
    1 point
  7. AutoIt native functions are coded in C++, you cannot just add an AutoIt script to it, they need to be written in C++.
    1 point
  8. I think we need a package manager for AutoIt to solve this problem. A lot of languages already adopted this way. A UDF shipped with AutoIt would be no different from any other user defined library and it would be very convenient, possibly even more convenient than how it works now, to include libraries into your project.
    1 point
  9. Betaleaf - from the Help file for FileWrite... I agree there is some inconsistency.
    1 point
  10. jchd

    Arrays

    The read function can and does detect file encoding hence using open before (working with a handle) would be extra work, but you need to open first to specify the encoding for writing. I'd say it's one of the least worrysome inconsistancy in the standard functions/UDFs.
    1 point
  11. EmilyLove

    Require a Serial

    Typo in the comments of your example code. Here http://prntscr.com/83ya4r and Here http://prntscr.com/83yaqr seial needs to become serial
    1 point
  12. User751139, Delighted I could help - but my wife insists that a simple "thanks" would have sufficed. M23
    1 point
  13. OhBobSaget, Or use my ChooseFileFolder UDF and then you can make your own buttons. M23 Edit: 24k
    1 point
  14. I Edit a Guinness code and got this: #include <GUIConstantsEx.au3> #include <WinAPIEx.au3> Global Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ;Must be global to allow compare HotKeySet("{F8}", "_ShowDialog") Example() Func Example() Local $hGUI = GUICreate('An(other) example by guinness - 2013', Default, Default) ; Create a GUI. GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function. _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _WinAPI_DeregisterShellHookWindow($hGUI) GUIDelete($hGUI) EndFunc ;==>Example Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Local $sTitle = "" Switch $wParam Case $HSHELL_WINDOWCREATED $sTitle = WinGetTitle($lParam) If WinGetProcess($lParam) = @AutoItPID And $sTitle=$sMessage Then ControlSetText($sTitle, "", "Button1", "AutoIt") ControlSetText($sTitle, "", "Button2", "Danyfirex") EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Func _ShowDialog() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>_Dialog Saludos
    1 point
  15. chrispetersinc, Nice first post. Necroing a 5 year old thread to comment on the tone of one of the posts - prepare yourself to be even more shocked by some of the other posts from that period, particularly from one individual. Anyway, this is the internet - either live with it or stay off-line. M23
    1 point
  16. Kitsune

    Copy Text to Variable

    here's a quick page ref since I'm about to crash CODEFileOpen -------------------------------------------------------------------------------- Opens a text file for reading or writing. FileOpen ( "filename", mode ) Parameters filename Filename of the text file to open. mode Mode (read or write) to open the file in. Can be a combination of the following: 0 = Read mode 1 = Write mode (append to end of file) 2 = Write mode (erase previous contents) 4 = Read raw mode 8 = Create directory structure if it doesn't exist (See Remarks). 16 = Force binary(byte) reading and writing mode with FileRead and FileWrite 32 = Use Unicode UTF16 Little Endian mode when writing text with FileWrite and FileWriteLine (default is ANSI) 64 = Use Unicode UTF16 Big Endian mode when writing text with FileWrite and FileWriteLine (default is ANSI) 128 = Use Unicode UTF8 when writing text with FileWrite and FileWriteLine (default is ANSI) Both write modes will create the file if it does not already exist. The folder path must already exist (except using mode '8' - See Remarks). Return Value Success: Returns a file "handle" for use with subsequent file functions. Failure: Returns -1 if error occurs. Remarks A file can only be in either read or write mode; it cannot be in both. Some file attributes can make the opening impossible. When opening a file in write mode, the file will be created if it does not exist. When finished working with a file, call the FileClose function to close the file. Autoit normally closes all files upon termination, but explicitly calling FileClose is still a good idea. The default mode when writing text is ANSI - use the unicode flags to change this. When writing unicode files the Windows default mode (and the fastest in AutoIt due to the least conversion) is UTF16 Little Endian (mode 32). When using the mode=4 (Raw Read) the filename is defined as "\\.\A:" for reading sector on a floppy disk the count must be a multiple of sector size(512). Non-existing directory structure: ------------------------------------ By default the file will not be created if the directory structure doesn't exist. To overwrite this behaviour use the modes '1' or '2' together with mode-flag '8'! For instance the mode-flag '9' (1 + 8) checks for the directory structure and if it doesn't exist creates it automatically and then opens the file for appending. Related FileClose, FileReadLine, FileWriteLine, FileRead Example $file = FileOpen("test.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileClose($file) ; Another sample which automatically creates the directory structure $file = FileOpen("test.txt", 10) ; which is similar to 2 + 8 (erase + create dir) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileClose($file) this page is part of the compiled html help file found in your AutoIt folder, its file size is roughly 72kb
    1 point
×
×
  • Create New...