Leaderboard
Popular Content
Showing content with the highest reputation on 01/14/2022 in all areas
-
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Earthshine and 3 others reacted to Jos for a topic
Guys, lets not get into a pissing contest as that leads nowhere and simply ignore the thread when you don't like what you read... there really is nothing to win here...4 points -
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Earthshine and 2 others reacted to Jos for a topic
Topic closed due to irrelevance of AutoIt claimed by the OP. I have grown tired of these word-walls with these BS stories. Either post relevant contributions or simply go somewhere else.3 points -
BS = post-digestive faecal excretions of adult males of the bos taurus species.3 points
-
You have to cast the last parameter (pointer to function): qsort @oarray(0), 10, Sizeof(Integer), Cast(Any Ptr, @QCompare) Or use Quicksort written in FB: Sub QsortA(array() As Integer, _start As Integer, _end As Uinteger) 'ascending _end = Iif(_end > Ubound(array), Ubound(array), _end) _start = Iif(_start < 0, 0, _start) Dim As Integer I = _start, J = _end Dim As Integer X = array(((I + J) \ 2)) While I <= J While array(I) < X 'change to > for descending I += 1 Wend While array(J) > X 'change to < for descending J -= 1 Wend If I <= J Then Swap array(I), array(J) I += 1 J -= 1 Endif Wend If J > _start Then QsortA(array(), _start, J) If I < _end Then QsortA(array(), I, _end) End Sub Sub PrintArray( karray() As Integer ) For position As Integer = LBound(karray) To UBound(karray) Print karray(position) ; Next Print !"\n"; End Sub Dim oarray(9) As Integer = { 10, 9, 6, 8, 5, 1, 3, 2, 7, 4 } PrintArray( oarray() ) QsortA( oarray(), 0, Ubound(oarray)) PrintArray( oarray() ) Sleep2 points
-
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Earthshine and one other reacted to Somerset for a topic
The backhanded compliments that this OP is handing out is ridiculous and borderline taunting is childish as well. As a long time user of autoit, I'd tell you to blow it out your porthole, but you are already doing that when you speak to the people who actually did the implementations of features. You're not helping by trying to inflate your own sense of accomplishment(s).2 points -
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Earthshine and one other reacted to Musashi for a topic
@markyrocks In advance : I don't want to make any judgement about the quality or usefulness of your work so far. It may be beneficial, perhaps even revolutionary, but perhaps maybe not. It is exactly this attitude that, in my opinion, is in conflict with one of the fundamental principles of this forum. There are many other projects (UDF's), developed by members(f,m,d) of the community, made available to users for free. Some of them have even managed to find its way into the official distribution of AutoIt over the time. Without this work of volunteers, which often takes years, AutoIt would not be what it is today (even if there is of course still room for improvement ). And last but not least, you yourself benefit massively from this "free" work done by other people. I fully agree with this !2 points -
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Earthshine and one other reacted to Nine for a topic
I personally don't like this kind of thread. I am not sure how it can help this community. I would suggest that it should be locked.2 points -
You are using strings, maybe... Local $num[5] = ["11","2","11","5","3"] MsgBox(0,"",$num[1]) MsgBox(0,"",$num[2]) IF Number($num[1]) > Number($num[2]) Then MsgBox(0,$num[1],$num[2]) EndIf1 point
-
Sort question in C++
TheDcoder reacted to markyrocks for a topic
I got no issues with this. Would have been nice to get a tag. Pixelsearch seems like one of the good ones. If anyone was following the other thread as I said in there the new version is drastically different than this. The whole thing was essentially rewritten to get rid of any copying except when absolutely necessary (strings) . That being said it doesn't even need a struct it just sorts the pointers at the actual autoit variant type variable. That and I eliminated all calls to processread/write. I'm almost ready to drop a new version. Getting to the strings is some Uber obscure syntax but I got em. I promise I'm not going to hijack this thread. I would have helped out but I didn't see this until just now. It took me roughly 5 years to get to this point with c++. I'm like so good with it I'm beginning to think that I can see into the future. Joking. Goodluck. Take care.1 point -
Absolutely! And please bear with me if I come up with any question or suggestion during the translation process. I only hope that I can finish it successfully. For your information, I once ran Google translation tool on your book and I decided it was not usable. Thanks and regards, CY Cho1 point
-
@CYCho Really glad you are enjoying the book. I am fine with your translating it to Korean. I would only ask for attribution as the original author and then perhaps something like "as translated by" for your efforts. So it could read "Learn to Program With Free Tools Using Autoit by Jfish as translated by CYCho". Does that sound okay?1 point
-
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Earthshine reacted to markyrocks for a topic
Updated 1/4/2022: added pointer sort test, float sort test, double sort test, insort test, enums and a few other utility functions. The .ccp is kinda messy rn. Not too worried about it. Updated 1/9/22 ... I totally missed the fact that the dll wasn't actually included in the files. Duh. Been so busy sry. Its in there now. The files originally on this page are gone It's an obsolete test anyways. I've move far beyond it. Its been replaced with the latest test/example. Sorry I suck and files and editing posts apparently. So what got me started down this road is from another recent thread i'm sure you've all seen it. I don't use autoit that much anymore except for trying to break it or make it do stuff that it doesn't want to, in an effort to improve it if I can. Writing this actually just gave me an idea which is pretty cool. Anyways. It seems that theres a fear of using arraysort bc its so amazingly slow which it is. I was wondering if i could fix that and well.... I did to a small degree. It would need to get alot more complicated from here to actually fix it the write way so that it would be full featured and recognize autoit datatypes and pass that information along and on the dll end it would need some overloads or a "more elegant" solution. That being said all this does is work on integers atm. ## copying the array to a dllstruct takes about 1500 ms ... the dll sort takes about 25 ms. (on my pos 5 year old laptop) copying the resulting sorted struct to a autoit array takes about 1500 miliseconds ## The built in arraysort takes roughly 10x longer of those combined. So simply accessing from the resulting dllstruct will deffinitly save some time. I played around with this for a few hours, tested it many times so that I made sure its all working correctly. anyways I'll post the test script here and attach the source.cpp and header if anyone wants to build it themselves and the dll.1 point -
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Earthshine reacted to Danyfirex for a topic
So, move to python 🤣 That way you'll avoid the big AutoIt problems 🤔 Saludos1 point -
"StdoutRead() does not block, it will return immediately." Try adding " & @LF" to the end of your StdinWrite() calls, as this does normally trigger execution. StdinWrite(PID) > maybe remove these calls? If the stream is closed, it's gone. "If the function is called with no second argument, StdinWrite() closes the stream and invalidates it for further writing."1 point
-
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Musashi reacted to Earthshine for a topic
This thread certainly is BS A half baked solution to a problem nobody cares about because everybody else uses SQL database or they’ll use a different language completely1 point -
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
Earthshine reacted to Jos for a topic
...and we all know what that led to..... and indeed ignore BS in general is the best stategy1 point -
@Nine Although I agree that "The tone of voice in this thread" can be different but I remember days with Valik where it was even worse. I see an enthusiast diving into an area of optimiziation of arrray sorting of numbers which is a small subarea of AutoIt and it will grow to a UDF or not. If not shared (or stays at 0.1 version) we move on to the next thread.1 point
-
Why is _ArraySort so broken? Updated 1/9/22 630pm g2g
JLogan3o13 reacted to Melba23 for a topic
markyrocks, You just keep on feeling embarrassed for us - no-one else here does. Could it be the two things are connected? A point worth pondering...... Or could it be the fact that: Anyway I am out of here - enjoy your coding. M231 point -
This is an UDF that helps you use Font Awesome in your AutoIt project. Screenshot Download Click here to download! Usage/Example #NoTrayIcon #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ; Font Icon UDF by Juno_okyo #include <font-icon.au3> Opt('GUIOnEventMode', 1) #Region ### START Koda GUI section ### Global $FormMain = GUICreate('Font Icon for AutoIt by Juno_okyo', 355, 126, -1, -1) GUISetFont(20, 400, 0, 'Arial') GUISetOnEvent($GUI_EVENT_CLOSE, 'FormMainClose') GUIStartGroup() Global $Label1 = GUICtrlCreateLabel('Juno_okyo', 25, 42, 155, 36) GUICtrlSetFont(-1, 24, 400, 0, 'Arial') ; See demo.html for Icon name Global $Label2 = GUICtrlCreateLabel(Font_Icon('icon-heart'), 193, 46, 35, 36) GUICtrlSetFont(-1, 20, 400, 0, 'juno_okyo') ; Font name GUICtrlSetColor(-1, 0xa83f39) ; Heart color ;) Global $Label3 = GUICtrlCreateLabel('AutoIt', 235, 42, 90, 36) GUICtrlSetFont(-1, 24, 400, 0, 'Arial') GUIStartGroup() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func FormMainClose() Exit EndFunc Credits Author: Juno_okyo Font Awesome by Dave Gandy Source code on GitHub. Contributing are welcome!1 point
-
Motivation Hi guys. Coming from a more commercial environment, always seen with difficulty the fact of AutoIt (and other languages) do not accept masks during data entry. Of course, we have the EDIT fields (GUICtrlCreateInput), but normally are open fields that accept any kind of information. I noticed here and there some attempts to filter or restrict a few characters, allow others and so on. But always there was the need to customize the script for every situation, what I think is a waste of time and code. And especially the fact that prevent multiple programmers to present a more professional aspect to your work, because it required additional programming and knowledge. Understand that when we talk about business systems, data entry is very significant because the amount of data to be entered is too large. When we carry out this data entry, any interaction between keyboard and mouse delays the release of information. Think of how much time is lost between take your hand from the keyboard, get the mouse, find the cursor, click on the option (or options), click on the next field and finally back to the keyboard. It may seem silly, but this process repeated several times a day makes a huge difference. The solution is not to "eliminate" the mouse, but minimize his use, maximizing the keyboard as a whole, in the process of data entry! Another situation that bothers me is the fact that every control you need in addition to the initial and final coordinates, size and width of the field (that annoying thing be adjusting this). And not to mention that this "width" and "height" are still dependent on the font used. Sometimes, you adjust the size with a font, then decides to change (increase, decrease, put bold, etc) and there goes the entire service to the trash. At least when you create a label you can skip these steps, yet few know that. I spent a lot of time doing screens and stating the size and height of the label when not needed. As the Help is optional, but the examples and other codes always reported those numbers and I went along for the ride... Recently I had to change the font of a screen ever assembled and truncated all! I thought to myself that it couldn't be that hard and I was looking for, then I found out that the size and width of the label are optional, that is, it adjusts according to the font used at the time of opening the window. But if on the one hand eased enough to create the labels, the same cannot be said for the inputs. Theoretically (on the Help) you can leave blank these options too but the result is awful! Slowly was assembling a pattern in my head. Ideally, that formatting might follow some rules: be optional (use who wants and when it wants to) not in the way the other fields, including to allow retro-compatibility being optional, you can use only for fields that you need or require additional formatting need to adjust the size of the field to the chosen font (and its characteristics such as size, bold, height, etc) finally, allow creating a system of masks that were easily used (little training but highly flexible) format "on-the-fly", i.e. will formatting as you typing Challenge The biggest challenge was to assemble the mask system. Regular expressions (RegExp) were right, but not everyone is familiar enough to use. But it was a starting point. Then I created a second pattern that allowed both the use of RegExp and a facilitator for the most common cases. I got to the following pattern, which I called macros: 9 - only allows numbers fro 0 to 9. In RegExp \d A - only allows letters from A to Z. In RegExp [a-zA-Z] X - allows letters (from A to Z) and number (from 0 to 9). In RegExp [0-9a-zA-Z] H - allows hexadecimals (numbers from 0 to 9 and letters from A to F). In RegExp [0-9a-fA-F] @ - allows any character between ASC code 32 (space) until ASC code 126 [tilde]. In RegExp [\x20-\x7E]. Basically anything you can type (in Latin alphabet). With these settings (macros) to create a series of masks that can be easily adapted to various situations and fields. For example (using Brazilian common inputs): CPF: 11 digits with some markers = 999.999.999-99 CNPJ: 14 digits with markers = 99.999.999/9999-99 Vehicle ID: 3 letters and 4 numbers with markers = AAA-9999 Zip Code: 8 digits with markers = 99.999-999 Brazil cellphone: 11 digits (area code, prefix and number) = (99) 99999-9999 Internacional phone: 13 digits (country code, area code, prefix and number) = +99 (99) 99999-9999 MAC Address (MAC code from network card): hexa group by 2 = HH:HH:HH:HH:HH:HH and so on... In addition, any field can be described using RegExp too, which makes the system fully flexible and adaptable to any situation. For example: Vehicle ID (macro style) = AAA-999 RegExp style = [A-Z][A-Z][A-Z]-\d\d\d\d or just like this = [A-Z]3-[\d]4 But using macros is easier to understand and work right? By the way, still can not mix standard RegExp with macros. Maybe later... Let's complicate a bit? If you need a field which can only accept a character from B to J and then 2 numbers and ends with 3 more letters, looks like this: [B-J]\d\d[A-Z][A-Z][A-Z] It is harsh to read, but it works! Another point to be explored are the styles combined with masks. The styles are the last parameters of the GUICtrlCreateInput function and are very important to complement the subject. There are styles to align to the right and to the left, center it, or capitalize, accept only password fields or read-only. An ideal setting for the masks involves these two factors and the programmer know that! To make a field to accept only uppercase letters => GUICtrlCreateInput("", 10, 35, 300, 20, $ES_UPPERCASE) Only lowecase => GUICtrlCreateInput("", 10, 35, 300, 20, $ES_LOWERCASE) Center => GUICtrlCreateInput("", 10, 35, 300, 20, $ES_CENTER) If you want to mix can also using BitOr function => GUICtrlCreateInput("", 10, 35, 300, 20, (BitOr($ES_UPPERCASE, $ES_CENTER)) I know I'm raining in the wet here because all of this is on Help and you guys already know, but it never hurts to remember! Mainly because when mounting a mask makes a difference. Imagine setting a mask like [A-Z] and put $ES_ LOWERCASE in style? It's not going to work. Conclusion So it was set that there would be 3 (three) types of fields, all formatting "on-the-fly" as are typed: TEXT field: accepts masks NUMBER field: like a calculator, from right to left DATE field: accepts only numbers but that converts it to a format of "expanded date" (dd/MMM/yyyy) when leaving the field and with various options of format (DMY, MDY, etc). With automatic validation. The DMY format and its variants (MDY, YMD, etc) are to allow the entry of dates in other standards according to each country. In the USA the default is MDY, in Brazil and England is DMY. Military use YMD and so on. You can use the GUICtrlCreateDate command to create a data input "text plus calendar", but in this case, only the size calculation (font) will be made. So the function ended up like this: _GUICtrlSetMask(<ControlID>, <Input Type>, <Mask>[, <Extra Info>]) where: ControlID = control code to be formatted. You can use -1 if you want it to be the last created Input Type = 0 ($INPUT_DATE), 1 ($INPUT_NUMBER), 2 ($INPUT_TEXT) Mask = Mentioned masks. If you use macros (@, 9, A, X, H) need to put # at the beginning and end Extra Info = depends on the chosen format may contain additional information Examples of each type: Numbers ($INPUT_NUMBER): _GUICtrlSetMask($nCampo_Codigo, $INPUT_NUMBER, 6) ; Setting for number with 6 (six) digits WITHOUT decimals (999,999) _GUICtrlSetMask($nCampo_Preco, $INPUT_NUMBER, 9, 2) ; Setting for number with 9 (nine) digits PLUS 2 (two) decimals) (999,999,999.99) Date ($INPUT_DATE): _GUICtrlSetMask($nCampo_Aniversario, $INPUT_DATE, "DMY") ; Setting for date and format DAY, MONTH and YEAR, with standard marker / (stroke) _GUICtrlSetMask($nCampo_NF_Saida, $INPUT_DATE, "YMD", "-") ; Setting for date and format YEAR, MONTH and DAY with marker - (minus) Text ($INPUT_TEXT): _GUICtrlSetMask($nCampo_Nome, $INPUT_TEXT, "#[@]50#") ; Setting the text field for 50 (fifty) characters max _GUICtrlSetMask($nCampo_Nome, $INPUT_TEXT, "#[@]50#", 20) ; Setting the text field for 50 (fifty) characters max, but with max widht of 20 (twenty) characters and activating horizontal scroll _GUICtrlSetMask($nCampo_CNPJ, $INPUT_TEXT, "#99.999.999/9999-99#") ; Setting for text field with CNPJ mask (Brazilian corporation) _GUICtrlSetMask($nCampo_CEP, $INPUT_TEXT, "#99.999-999#") ; Setting for text field with Brazilian ZIP code mask Comments When to use text type, don't forget to put the mask between # (hashtag). When using date type, don't forget the date format, because it must be of the same input format. Usually, we use the _NowCalcDate() function to we initialize our date variables, but you have to remember that in this case the content is YMD format. In this case, we need to change the date format using a helper function _MUDA_FORMATO_DATA selecting the format you wish. Example.: $sData = _MUDA_FORMATO_DATA(_NowCalcDate(), "YMD", "DMY") => We initialize with _NowCalcDate (YMD format) and exchanged for Brazil (DMY format) To initialize the masks subsystem it is necessary to call the function INIT_MASCARAS which has 3 (three) parameters, all optional: _INIT_MASCARAS([BackgroundColor][, <PRE-Format>[, <POS-Format>]]) onde: BackgroundColor = color to highlight the field is being typed. Default 0xFFFF99 (light yellow) PRE-Format = True (default) or False. Is used for when you open the window, pre-format fields properly according to his content TRUE => CEP field, mask 99.999-999, content "90123789", when open the windows shows "90.123-789" FALSE => CEP field, mask 99.999-999, content "90123789", when open the windows shows "90123789" POS-Format = True or False (default). Is used for when you open the window, unformat the fields or eliminate the masks applied TRUE => CEP field, mask 99.999-999, content "90.123-789", when close the window keep the content as "90.123-789" FALSE => CEP field, mask 99.999-999, content "90.123-789", when close the window change the content to "90123789" These definitions are for when they are read with the command fields GUICtrlRead, come as the AutoIt (without formatting). Finally, after closing the window, release the subsystem via function _RELEASE_MASCARAS() Also when we talk about data entry, as far as possible to the ideal is that the ENTER key (in addition to the TAB) can be used as the terminator entry and move to the next field. Could do this internally, but I realized that it is very personal. Hence I prefer to let the position of each, but the template is quite simple and is in the example. You can also do "individual" validation of each field, which would complete the input formatting. For example, when you finish receiving a CNPJ or CPF, can validate that the code. Or if given date is allowed and so on. Of course, the function is not perfect nor is never complete, but I'm counting on the participation of colleagues to me indicate the errors, your suggestions and criticism. Thanks in advance! Sorry for my bad English, I'm just a Brazilian guy. PS. Check out our AutoIt Brazilian forum => http://forum.autoitbrasil.com/index.php Demonstration https://imgur.com/KsDSlGb Example #include "Mascaras.au3" PRINCIPAL() Exit Func PRINCIPAL() _INIT_MASCARAS() Local $nTamanho_Fonte_Input = 12 Local $nMsg, $nControle, $hJanela = GUICreate("Input Masks", 620, 460) GUISetFont(11, $FW_NORMAL, $GUI_FONTNORMAL, "Arial", $hJanela, $CLEARTYPE_QUALITY) Local $Codigo = 1234 Local $Valor = 12345.6 Local $Nome = "User Name" Local $CPF = "12345678901" Local $CNPJ = "12345678000901" Local $MAC = "7B891506F1C7" Local $CEP = "90040123" Local $sFormato_Data = "MDY" Local $Data = _MUDA_FORMATO_DATA(_NowCalcDate(), "YMD", $sFormato_Data) Local $Placa = "ABC1234" Local $Telefone = "11999706050" Local $Internacional = "1123456789" GUICtrlCreateLabel("Code:", 50, 50) Local $Campo_Codigo = GUICtrlCreateInput($Codigo, 100, 45) _GUICtrlSetMask(-1, $INPUT_NUMBER, 6, 0) GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("Value:", 350, 50) Local $Campo_Valor = GUICtrlCreateInput($Valor, 400, 45) _GUICtrlSetMask(-1, $INPUT_NUMBER, 9, 2) GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("Name:", 50, 100) Local $Campo_Nome = GUICtrlCreateInput($Nome, 100, 95, Default, Default, BitOR($ES_UPPERCASE, $ES_AUTOHSCROLL)) _GUICtrlSetMask(-1, $INPUT_TEXT, "#[@]60#", 40) GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("Date1:", 50, 150) Local $Campo_Data1 = GUICtrlCreateInput($Data, 100, 145) _GUICtrlSetMask(-1, $INPUT_DATE, $sFormato_Data) GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("Date2:", 350, 150) Local $Campo_Data2 = GUICtrlCreateDate(_NowCalcDate(), 400, 145) _GUICtrlSetMask(-1, $INPUT_DATE, "dd/MMM/yyyy") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("CNPJ:", 50, 200) Local $Campo_CNPJ = GUICtrlCreateInput($CNPJ, 100, 195) _GUICtrlSetMask(-1, $INPUT_TEXT, "#99.999.999/9999-99#") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("CPF:", 350, 200) Local $Campo_CPF = GUICtrlCreateInput($CPF, 400, 195) _GUICtrlSetMask(-1, $INPUT_TEXT, "#999.999.999-99#") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("MAC:", 50, 250) Local $Campo_MAC = GUICtrlCreateInput($MAC, 100, 245, Default, Default, $ES_UPPERCASE) _GUICtrlSetMask(-1, $INPUT_TEXT, "#HH:HH:HH:HH:HH:HH#") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("ZIP:", 350, 250) Local $Campo_CEP = GUICtrlCreateInput($CEP, 400, 245) _GUICtrlSetMask(-1, $INPUT_TEXT, "#99.999-999#") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("License:", 80, 300) Local $Campo_Placa = GUICtrlCreateInput($Placa, 100, 295, Default, Default, $ES_UPPERCASE) _GUICtrlSetMask(-1, $INPUT_TEXT, "#AAA-9999#") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("License:", 380, 300) Local $Campo_Placa1 = GUICtrlCreateInput($Placa, 400, 295) _GUICtrlSetMask(-1, $INPUT_TEXT, "[a-zA-Z]3-[0-9]4") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("Phone:", 60, 350) Local $Campo_Telefone = GUICtrlCreateInput($Telefone, 100, 345) _GUICtrlSetMask(-1, $INPUT_TEXT, "#(99) 99999-9999#") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) GUICtrlCreateLabel("Phone:", 360, 350) Local $Campo_FoneIntl = GUICtrlCreateInput($Internacional, 400, 345) _GUICtrlSetMask(-1, $INPUT_TEXT, "#+55 (99) 9999-9999#") GUICtrlSetFont(-1, $nTamanho_Fonte_Input, $FW_BOLD, $GUI_FONTNORMAL, "Tahoma", $CLEARTYPE_QUALITY) Local $Ok = GUICtrlCreateButton("Ok", 145, 400, 75, 25, $WS_GROUP) Local $Cancelar = GUICtrlCreateButton("Cancel", 360, 400, 75, 25, $WS_GROUP) Local $nMyDummy = GUICtrlCreateDummy() Local $aHotkey = [ [ "{ENTER}", $nMyDummy ], [ "{TAB}", $nMyDummy ] ] GUISetAccelerators($aHotkey) GUISetState(@SW_SHOW, $hJanela) While True $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then ExitLoop If $nMsg = $Ok or $nMsg = $Cancelar Then ExitLoop If $nMsg = $nMyDummy Then $nControle = _GuiCtrlGetFocus($hJanela) If $nControle = $Ok or $nControle = $Cancelar Then ExitLoop ElseIf $nControle = $Campo_Nome Then If GUICtrlRead($Campo_Nome) = "" Then ContinueLoop ; do not allow empty name ElseIf $nControle = $Campo_Data1 Then If GUICtrlRead($Campo_Data1) = "" Then ContinueLoop ; do not allow empty date ElseIf $nControle = $Campo_CPF Then ;~ If not VERIF_CPF(GUICtrlRead($Campo_CPF)) Then ContinueLoop ElseIf $nControle = $Campo_CNPJ Then ;~ If not VERIF_CNPJ(GUICtrlRead($Campo_CNPJ)) Then ContinueLoop EndIf GUISetAccelerators("") ControlSend($hJanela, "", $nControle, "{TAB}") GUISetAccelerators($aHotkey) EndIf WEnd GUISetState(@SW_HIDE, $hJanela) ConsoleWrite("[" & GUICtrlRead($Campo_Codigo) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_Valor) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_Nome) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_CPF) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_CNPJ) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_MAC) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_CEP) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_Data1) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_Data2) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_Placa) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_Placa1) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_Telefone) & "]" & @CRLF) ConsoleWrite("[" & GUICtrlRead($Campo_FoneIntl) & "]" & @CRLF) GUIDelete($hJanela) _RELEASE_MASCARAS() EndFunc ;==>PRINCIPAL Attention!!! Due to changes between the versions 3.3.14.2 e 3.3.14.3 of AutoIt there are 2 versions of this function to download! Check and download the correct version for your installation. The sample program is the same for both versions. The only difference between the two versions are the #includes at the beginning of the file. In version 14.2 it's like that: #include <Date.au3> #include <Array.au3> #include <String.au3> #include <WinAPILocale.au3> #include <EditConstants.au3> #include <FontConstants.au3> #include <MenuConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> And in vesion 14.3 it's like that: #include <Date.au3> #include <Array.au3> #include <String.au3> #include <WinAPIConv.au3> #include <WinAPIGdiDC.au3> #include <WinAPILocale.au3> #include <WinAPISysWin.au3> #include <EditConstants.au3> #include <FontConstants.au3> #include <MenuConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Summarizing, the latest version has the following extra #includes: #include <WinAPIConv.au3> #include <WinAPIGdiDC.au3> #include <WinAPISysWin.au3> Otherwise it's all the same. Happy coding everyone. To Do: - remove all the errors (LOL - never happen) - better coding - validate function for every field (not allowing to go to another field without validation) Mascaras v14.2.au3 Mascaras v14.3.au31 point
-
This is an AutoIt UDF to help you upload images using Imgur API. Simple example: #NoTrayIcon #include 'Imgur.au3' Global $fp = FileOpenDialog('Open', @ScriptDir, 'Images (*.jpg;*.gif;*.png;*.bmp)', 1) If Not @error Then Local $image_url = _imgur_upload($fp) If @error Then MsgBox(16 + 262144, 'Error', 'Upload image failed!') Else ; Open with default browser ShellExecute($image_url) EndIf EndIfDownload: Imgur UDF by Juno_okyo.zip Github: https://github.com/J2TeaM/AutoIt-Imgur-UDF ----- In the UDF, I have used Base64 and JSON UDF by @Ward. Thank you!1 point
-
Hi folks! I bring this little executable file and an AutoIt wrapper for it to generate documents (bills and incomes) by sending variables (strings, numbers or even arrays) to a PHP script you wrote. This is the syntax: themecli.exe <input> <output> <vars> input: The input PHP file (the extension does not need to be .php, it can be anything, like .html, .txt, .bin, .wtf...), relative to @ScriptDiroutput: The output HTML file to save, relative to @ScriptDirvars: A base64-encoded JSON with all the variables (hard? Don't worry! See below:)Looks confusing? Well, don't worry. That's why we have a wrapper! Example, if we have this file "page.php": Hello, <?=$user?>! How are you?And do this with AutoIt (using my JSONgen UDF [ http://www.autoitscript.com/forum/index.php?showtopic=173797 ] which is already included in AutoPHP): #include 'inc\autophp.au3' $ojson = New_JSON() JSON_AddElement($ojson, 'user', 'John Doe') $json = JSON_GetJSON($ojson) AutoPHP('page.php', 'hello.txt', $json)Note that you don't need to base64-encode it. After running it, we will see a file named "hello.txt", and the content is: Hello, John Doe! How are you?On the PHP file you can also use loops and everything else supported in PHP4 (since it uses Bambalam PHP Compiler, it does not support PHP5 yet). On the zip file there is an example of how to use it with loops. License: same Bambalam PHP Compiler license: Tip: If you use wkhtmltox, you'll be able to convert the generated HTML file into PDF with just a few lines! See here: https://www.autoitscript.com/forum/topic/173611-wkhtmltox-autoit-objectclass-to-convert-html-filespages-into-pdf-and-images/ Download: AutoPHP.zip full script, dependencies and examples (everything you need to start using AutoPHP) phpthemecli-src.zip Themecli binary and source (Themecli is the tool that AutoPHP uses to run PHP code - since it's already included on AutoPHP UDF, you don't need to download it, unless you want to use it with another programming language)1 point