Jump to content

TechCoder

Active Members
  • Posts

    185
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by TechCoder

  1. I'm lost on this one........ What I NEED is to have cURL work with CUSTOMREQUEST headers as I need to have DELETE as an option - as stated in if anyone knows how to do this any other way, I am open to hear that!) I've used cURL in php a few times and it always has been fast and worked first time. But, using this UDF, I have been fighting this thing all day and getting nowhere.... EDIT: Test Bed removed (as this was resolved) here's the php <html> <form method="post"> Enter 1 for CURLOPT_POST (Standard) or anything else for CURLOPT_CUSTOMREQUEST (Custom) <br> <input type="text" name="testit" value="1"> <input type="submit" name="submit" value="submit"> </form> <?php $user = "AutoItuser"; $pass = "AutoItuser"; $testit = $_REQUEST['testit']; $sURL = "http://example.com/test/Booked/Web/Services/Authentication/Authenticate"; $body = '{"username":"' . $user . '","password":"' . $pass . '"}'; $header_type = "POST"; $hcurl = curl_init(); echo "body is $body<br>"; if ($hcurl) { //setup the URL curl_setopt($hcurl, CURLOPT_URL, $sURL); //set up for output of callback curl_setopt($hcurl, CURLOPT_RETURNTRANSFER, true); echo "testit is $testit<br>"; If ($testit == '1') // STANDARD { echo "working with STANDARD options<br>"; curl_setopt($hcurl, CURLOPT_POST, true); } Else // using CUSTOM { echo "working with CUSTOM options<br>"; curl_setopt($hcurl, CURLOPT_CUSTOMREQUEST, $header_type); } curl_setopt($hcurl, CURLOPT_POSTFIELDS, $body); // grab URL and pass it to the browser $reply = curl_exec($hcurl); echo __LINE__ . " this is the reply we got from curl_exec ==>>$reply<<==<br><br>"; // close cURL resource, and free up system resources curl_close($hcurl); } ?> That works - in both methods Now, the 'same' code, in AutoIt..... #include <libcURL.au3> Global $bMyData = Binary("") _Demo1() Func _Demo1() Local $user = "AutoItuser" Local $pass = "AutoItuser" Local $testit = InputBox("SELECT", "Enter 1 for 'CURLOPT_POST as in php'" & @CRLF & "2 for 'CUSTOMREQUEST as works in php'" & @CRLF & "or anything else for 'best AutoIt so far'", 1) Local $sURL = "http://example.com/test/Booked/Web/Services/Authentication/Authenticate" Local $body = '{"username":"' & $user & '","password":"' & $pass & '"}' Local $header_type = "POST" Local $hcurl = _curl_easy_init() ConsoleWrite("body is " & $body & @CRLF) If ($hcurl) Then ; setup the URL Local $tCURLSTRUCT_URL = DllStructCreate("char[" & StringLen($sURL) + 1 & "]") DllStructSetData($tCURLSTRUCT_URL, 1, $sURL) _curl_easy_setopt($hcurl, $CURLOPT_URL, DllStructGetPtr($tCURLSTRUCT_URL)) ; set up for output of callback Local $handle = DllCallbackRegister("_my_vwrite", "uint:cdecl", "ptr;uint;uint;ptr") _curl_easy_setopt($hcurl, $CURLOPT_WRITEFUNCTION, DllCallbackGetPtr($handle)) _curl_easy_setopt($hcurl, $CURLOPT_VERBOSE, 1) If $testit = 1 Then ; STANDARD POST _curl_easy_setopt($hcurl, $CURLOPT_POST, True); _curl_easy_setopt($hcurl, $CURLOPT_POSTFIELDS, $body); ElseIf $testit = 2 Then ; using _curl_easy_setopt($hcurl, $CURLOPT_CUSTOMREQUEST, $header_type); _curl_easy_setopt($hcurl, $CURLOPT_POSTFIELDS, $body); Else _curl_easy_setopt($hcurl, $CURLOPT_HTTPPOST, $body); EndIf Local $iRes = _curl_easy_perform($hcurl) If $iRes > $CURLE_OK Then ConsoleWrite("!CURL; " & _curl_easy_strerror($iRes) & @CRLF) ElseIf $iRes = $CURLE_OK Then ConsoleWrite("+>CURL; Success!" & @CRLF) Local $sContentType $iRes = _curl_easy_getinfo($hcurl, $CURLINFO_CONTENT_TYPE, $sContentType); If $iRes = $CURLE_OK Then ConsoleWrite("+>CURL; We received Content-Type: " & $sContentType & @CRLF); $reply = BinaryToString($bMyData) ConsoleWrite(@ScriptLineNumber & " " & " this is the reply we got =>>" & @CRLF & $reply & @CRLF & "<<=" & @CRLF) EndIf EndIf _curl_easy_cleanup($hcurl) EndIf EndFunc ;==>_Demo1 Func _my_vwrite($buffer, $size, $nmemb, $stream) Local $vData = DllStructCreate("byte[" & $size * $nmemb & "]", $buffer) $bMyData &= DllStructGetData($vData, 1) Return $size * $nmemb EndFunc ;==>_my_vwrite To document everything I've tried through the day would take pages, so I'll let this code stand on its own- it is the 'best' so far to use _curl_easy_setopt($hcurl, $CURLOPT_HTTPPOST, $body); though it is not working (still not getting authenticated) but is the only function I have found that yields ANY result other than errors..... This is one of those 'weekend projects' I took on that has turned into 20-something hours since Friday afternoon and still hasn't gotten off the ground!
  2. depending on your encryption technique, you may have to break long strings into segments, encrypt each, then tie the string back together. One of the UDFs I found on this forum has a limit to 16 characters, which makes it more difficult to deal with, but once the programs are written to encrypt and decrypt, the length of string really doesn't matter too much (though there will be more processing time used, so balance things as best you can). It is actually not a bad idea to keep strings small to encrypt then tie back together in a 'bundle' - it makes it a degree of difficulty harder for someone to decrypt it. I would further suggest you vary the length of the breaks and rarely (if ever) break out a key pieces of data to encrypt by itself (as discussed in the other thread, say, for instance, you are going to grab the UUID, drive info, motherboard, etc. of a computer, you should tie them together, then break in various locations, encrypt each and put it all back into one string.) Example (not all the code, but the comments!) ; gather data that we want to encrypt (UUID, drive info, motherboard in this example) ; get UUID $UUID = (function to get the UUID) ; get disk drive info $DriveInfo = (function to get the drive info) ; get computer board number $CompBoardNo = (function to get that data) Now, say we have $UUID (10 characters) $DriveInfo (15 characters) $CompBoardNo (8 characters) ; put them all together in one string $sStringToEncrypt = $UUID & $DriveInfo & $CompBoardNo ; break the string into small groups (if you make this various sizes, you will be more 'secure' (somewhat more difficult to decrypt/understand) For this example, let's divide it into 4 parts(i.e., we decided not to use the above option - see how it is up to you how 'difficult' you want to make things and it will give a different result!) There's 33 characters total, so 4 parts would be 3 with 8 and one with 9 characters (already different lengths) ; encrypt each part $eString1 = _my_encrypt_function($sString1_toencrypt) $eString2 = _my_encrypt_function($sString2_toencrypt) $eString3 = _my_encrypt_function($sString3_toencrypt) $eString4 = _my_encrypt_function($sString4_toencrypt) ; put them back together $eStringToProcessFurther = $eString1 & $eString2 & $eString3 & $eString4 to decrypt, just reverse the process.
  3. The UDF from worked for me, though trying to stop it, etc. didn't. What I wanted is to have a way to take a picture 'at will', then show that latest picture for as long as I wanted, then switch back to the webcam when I wanted (in other words, some sort of control over what is happening as well as getting that latest pic to show - in the same spot as the webcam). My total application is not done, so there may be more features I'll put in overall, though here's some code (tested, working on my system) that might be of use to others. Note that it uses 'brute force' methods as I'm still new to GUI, etc. but the end result is that it works! #include <GUIConstants.au3> #include <WebcamUDF.au3> ; create webcam $webcamgui = GUICreate("webcam", 250, 192, @DesktopWidth/2 - 250/2,@DesktopHeight/2 - 192/2, $WS_POPUP) _WebcamInit() _Webcam($webcamgui, 250, 192, 0, 0) GUISetState(@SW_SHOW) $picgui = GUICreate("picture", 251, 192, @DesktopWidth/2 - 250/2, @DesktopHeight/2 - 192/2, $WS_POPUP) GUISetState(@SW_HIDE) ; create controls $gui = GUICreate("controls", 250, 80, @DesktopWidth/2 - 250/2, @DesktopHeight/2 - 192/2 + 192,$WS_POPUP) $button = GUICtrlCreateButton("picture", 10, 10) $webcam = GUICtrlCreateButton("webcam", 90, 10) $snapit = GUICtrlCreateButton("Take Picture", 160,10) $closeit = GUICtrlCreateButton("Close",90,50) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE,$closeit _WebcamStop() Exit Case $button ; create picture $picgui = GUICreate("picture", 250, 192, @DesktopWidth/2 - 250/2, @DesktopHeight/2 - 192/2, $WS_POPUP) $picshow = GUICtrlCreatePic("snapshot.bmp", 0, 0, 250, 192) GUISetState(@SW_SHOW) Case $webcam GUIDelete($picgui) case $snapit GUIDelete($picgui) ConsoleWrite("Taking snapshot ..." & @CRLF) _WebcamSnapShot() ConsoleWrite("Snapshot taken !" & @CRLF) EndSwitch WEnd
  4. if you are 1. using AutoIt 2. creating a database on your computer then I would suggest you look at SQLite for your database - it does not require a server (which MySQL does), it is free, takes most MySQL commands (or minor changes to them), and has great support on the forum. I had been using a portable server so I could run .php and MySQL (two things I programmed with for years on websites and thought I could do as well on a local computer), but after seeing the result of just a few weeks with AutoIt and SQLite (and some great coaching on how to best tweak things for speed), I find it to be a much better way to do database work locally. however, I will tell you like I was told and have learned to be the case - the link between AutoIt and SQLite is a real bottleneck (i.e., S L O W) so if you have a lot of heavy use to hit it (moving much data at a time) you will be better served to think things through on your development to see how you can utilize arrays instead. In fact, many things where people say they 'need' a database can be taken care of in an array - today's computers have big memory in them and can process that stuff directly in memory much faster than going to disk. I wound up using arrays for most of my needs, though found some things just are too difficult in arrays or even MUCH slower than going to the database (sorting on multiple columns comes to mind...), so I figured out a mix, saving when I had to and pulling only the minimum amount of bits really required at once, and learned a lot about 'clean' programming practice that I'd never worried about too much on fast servers running php. With AutoIt and its various tools, you can create things that look great (something php and html just can't compare with, IMHO), are easy and quick to put together, and run relatively fast (I'm still looking for ways to speed up my program - the php version runs the same calculations/features in <30 seconds where the AutoIt 'heavily trimmed' version takes nearly 2 minutes, though by reworking the flow of data, the user experience is not bad - end result, I am doing more in AutoIt everyday) That kinda sounds more like a testimonial than a recommendation, but hope it helps.
  5. yeah, the 9th was the mirrored, though I found another setting and now I can put the monitor in a lot more, nearly unlimited positions (I think they call that the 'Kamasutra' setting on the display.... and, while the function above was still reasonable, it was not giving me enough information to finish what I needed in my project after being able to move the monitor 'anywhere'. Found and have been working with it - so far, it is looking like the better solution for me, this time (every time I make a new program, and have some problem, I find new solutions - and with every solution, find another problem that needs new solutions)
  6. and it is just as useful today - by adding a tiny tweak, it works in the 9 positions I can put my second monitor. seems reasonable to me to update the thread (it is the best one on Google that relates to what I needed) with tested data for the next person searching for an answer.
  7. In case others have need for this function (which suits exactly my need - thanks!) and have options to put the monitor to the top, left, right or bottom, here's an updated If statement that better matched all the possibilities for me (verified with my setup - you should check values in $aArray to make sure it works for you). If $aArray[0]< 0 or $aArray[0] >= @DesktopWidth or $aArray[1] < 0 Or $aArray[1] >= @DesktopHeight Then This includes the window taking up the entire second screen (where it started at @Desktop.... ) and negative width/height position - the function does what I need, and works in all positions I tested.
  8. you stated though the instructions on the code you copied clearly stated you need to use the password as instructed when you log in. Why? $username = mysql_real_escape_string( $_POST['username'] ); $password = sha1( md5( PASSWORD_SALT ) . $_POST['password'] . PASSWORD_SALT); $query = "SELECT * FROM `{$db_table}` WHERE `username`='{$username}' AND `password`='{$password}'"; $username is not changed in any way (taken directly from the POST data and checked against the database) $password IS changed from the POST data, encrypted prior to being saved in the database (which stops people from getting into your database and stealing all the passwords - including YOU....) In other words, the 'fix' is for you to follow the instructions given and use 'test' as a password and NOT what you see in the database (and your 'abc' user will never be able to log in as the password of '123' is not properly encrypted, so you might as well delete it). If you want to add an account, add it using the AutoIt function and NOT directly in the database.
  9. nicely documented on what you have done/tried (shows you aren't just looking for a total hand-out solution, I like that) however, it seems you missed on one of the crucial points - WHAT HAPPENED that you don't like? You show the user/pass in the database, so congrats on getting that done, but " i also can not use it." tells little about what you were expecting to happen, etc. Give a bit more info on what you think should happen next and what DID happen. As I see the code, when you try to login, one of four responses should come back; "Error", "The server encountered an error, please try again later." "Failed", "Invalid username and/or password") "Success", "Your credentials seem to be valid.") "Unexpected Result", "Something went wrong") So, just what response are you getting when you go to log in? Also, I don't know (or personally care) if you are showing your real login details in the code, but you should be very careful to NEVER disclose such information. The standard way to 'hide' them is to change any/all references to a website to 'www.example.com', passwords to 'mypass' (you have that, but the rest looks like it might be real - if so, that is a horrible password to use on a live system). Perhaps the posted info is not real and you are safe with it, just pointing it out.....
  10. I believe that shows the base very well, so I believe 'create a .php and .sql for check' has been addressed. I also believe the 'teach me' has been addressed in my addition of ideas/suggestions/etc that can make the base code more secure. Perhaps your 'teach me' means 'show me where I could do better in the code'. If so, you will find help here - by showing your code and asking for help in areas you get stuck. It seems, though, that your 'teach me' means more 'do it for me' - that is not going to happen, for multiple reasons including the fact that creating security for your product is best done yourself (through taking the ideas/hints/suggestions given in this thread). Certainly any code I create for security on my products will not be posted publicly and anyone that would post such would be wasting their time in creating it! So, this is an area where 'ask for help when you get stuck' is the best (and IMHO, only) approach to going further.
  11. A couple of 'step up security' things I did in a php-only project that I'm now porting to AutoIt (the php code required a bit too much 'techie' from the user end, and had other issues, so porting it all over......) AutoIt side security code not yet started - too many other things to do getting the features working, then I'll tie in the security stuff just before public release, so below is just 'concept', though it works well in the php-only version. Also note that this is a bit of 'overkill' for the OP's question, though relates to the subject and other question about a 'Microsoft-ish' code. This is only one way to do it - the more 'mixed' you get, the better! 'Simple' Online Security Check To Create Unlock Code For Only One Machine IMPORTANT: The first thing for you to understand is that NO method of encryption, obfuscation or anything else will guarantee the code won't be cracked. Much like putting a security system in a house, there are various 'layers' you can provide to deter a 'common thief', but a determined pro can still get in. What you are looking to achieve is something that will make a hacker think "it is easier to just buy it than to crack it" - kind of like putting a lock on a glass window (generally, what is the point? though, it will give protection to some level) NEVER put anyone's personal information at risk by including it in your security check! (end of soapbox speech ... Note: this method does not 'require' an ssl connection, but it never hurts! 1. read the details from the machine they are on (there's a nice UDF for that) - UUID, board info, CPU, drive info, etc. (NO PERSONAL DATA!) 2. sprinkle in your feature unlock bits throughout the generated code (this serves to further 'lock the window'), putting the bits scattered around where only you know where they are (do not put them 'every 3rd character' or something - make it more difficult!) One thing you can do here is to take the first (for instance - be creative and use what you like!) character and 'key' off that to further tell where the feature bits are hiding (so, if the first character is '4', you might divide the string by 4, then look at the second character and go that many characters ahead, etc. - yes, it gets confusing - isn't that the point??? But, remember that you only have to do this once - for each side, then the programs talk automatically.) 3. encrypt that data using your own known 'salt' (there's a UDF for that...) - what you will come up with is a string that is something like 200 characters long (recommended to be 'long', but not 'massive' - you want it to transfer quickly) 4. send that string to the php side (similar to the above code) 5. the php side unravels what you put together into a) 'ID' code and 'Features' code (just like you put in) 6. Check the 'ID' code against the SQL server (I suggest you break out all the UUID, disk info, board, etc. and then do a 'percentage match' in case the user changes out a drive or something later) 7. Create a 'valid' string for various features (for instance, if the user has purchased the feature from a website, turn that on and next time they run the security check, that feature will be added) ================== NOW, DO IT IN REVERSE! ============================ 8. Use a DIFFERENT 'salt' and 'secret mix' in the server to create a string to return to the user computer. 9. Unravel that string in the local software and turn on the features. See, 'simple'! (less than 10 steps!)
  12. I look forward to testing it - in fact, I, too, was playing around a bit during the 'outage'..... see what you think about these ideas (and, sorry if they are already done and I haven't seen them - I wanted to d/l the other day, but......). mod for Array.au3 _ArrayDelete - add support for both types of arrays ; #FUNCTION# ==================================================================================================================== ; Author ........: Cephas <cephas at clergy dot net> ; Modified.......: Jos van der Zande <jdeb at autoitscript dot com> - array passed ByRef ; Modified.......: TechCoder - $iArrayType to support both Array types ; $iArrayType = 0 - where $avArray[0] = contains the first file (default) (data starts at position 0) ; $iArrayType = 1 - where $avArray[0] contains the number of files (data starts at position 1) ; $iArrayType = 2 - auto-determine which type ('best guess' when $avArray[0] = UBound($avArray)) ; @error = 5 for non-valid $iArrayType ; =============================================================================================================================== Func _ArrayDelete_Mod(ByRef $avArray, $iElement,$iArrayType = 0) If Not IsArray($avArray) Then Return SetError(1, 0, 0) If Not $iArrayType = 0 and Not $iArrayType = 1 and not $iArrayType = 2 Then Return SetError(5, 0, 0) Local $iUBound = UBound($avArray, 1) - 1 ; Bounds checking If $iElement < 0 Then $iElement = 0 If $iElement > $iUBound Then $iElement = $iUBound ; Move items after $iElement up by 1 Switch UBound($avArray, 0) Case 1 For $i = $iElement To $iUBound - 1 $avArray[$i] = $avArray[$i + 1] Next ReDim $avArray[$iUBound] Case 2 Local $iSubMax = UBound($avArray, 2) - 1 For $i = $iElement To $iUBound - 1 For $j = 0 To $iSubMax $avArray[$i][$j] = $avArray[$i + 1][$j] Next Next ReDim $avArray[$iUBound][$iSubMax + 1] Case Else Return SetError(3, 0, 0) EndSwitch ; Mod [0] if needed (for number in [0] type Arrays) Switch $iArrayType Case 0 ; do nothing Case 1 $avArray[0] = $iUBound Case 2 If $avArray[0] = $iUBound + 1 Then $avArray[0] = $iUBound EndIf EndSwitch Return $iUBound EndFunc ;==>_ArrayDelete_Mod Also, I did a bit of mod on the Sound UDF (we can move this to another thread if you like) mod to Sound.au3 Added ability to return REMAINING time in _SoundPos ; #FUNCTION# ==================================================================================================================== ; Author ........: RazerM, Melba23 ; Modified.......: $iMode 3/4 by TechCoder (3 = milliseconds remaining, 4 = hh:mm:ss remaining) ; =============================================================================================================================== Func _SoundPos($aSndID, $iMode = 1) ;validate $iMode If $iMode <> 1 And $iMode <> 2 And $iMode <> 3 And $iMode <> 4 Then Return SetError(1, 0, 0) If Not __SoundChkSndID($aSndID) Then Return SetError(3, 0, 0) ; invalid Sound ID or file name ;tell mci to use time in milliseconds __SoundMciSendString("set " & $aSndID[0] & " time format miliseconds") ;receive position of sound Local $iSndPosMs = Number(__SoundMciSendString("status " & $aSndID[0] & " position", 255)) If $aSndID[1] <> 0 Then $iSndPosMs -= $aSndID[2] EndIf If $iMode = 3 or $iMode = 4 Then $iSndPosMs = _SoundLength($aSndID,2) - $iSndPosMs EndIf If $iMode = 2 Or $iMode = 4 Then Return $iSndPosMs ;$iMode = 1 (hh:mm:ss) ;modify data and assign to variables Local $iSndPosMin, $iSndPosHour, $iSndPosSecs __SoundTicksToTime($iSndPosMs, $iSndPosHour, $iSndPosMin, $iSndPosSecs) ;assign formatted data to $sSndPosFormat Local $sSndPosHMS = StringFormat("%02i:%02i:%02i", $iSndPosHour, $iSndPosMin, $iSndPosSecs) ;return correct variable Return $sSndPosHMS EndFunc ;==>_SoundPos Made things a lot simpler in my music player to just return the timer other than having to calculate it again. I'm working on another project that I got started on during the 'down' and once I finish that I will be getting into the Beta world - only so many hours in a day.......
  13. Not fully tested yet, but I think the 'silent' songs are gone! I put in a label to constantly show _SoundStatus and was always getting 'stopped' as a result, even with the song playing. That took me a while to figure out - stupid mistake, I was looking at the filename instead of the handle returned by _SoundOpen........ (i.e, RTFM) Once I figured that out and re-sorted the code around, etc., I was able to get the proper status of 'playing' and then, was able to do the check for 'stopped' instead of the 'brute force' timeout method. So far, no more 'silent' songs (which, btw, before I put in the check for 'stopped', were showing NO status). End result - I believe it was a RACE CONDITION caused by using timing instead of reading _SoundStatus (I believe - more testing will prove that out, but I'm feeling very good about it - couple dozens songs played with no problem instead of every few songs being 'silent') So if you are seeing 'silent' songs, be very careful on the coding - and use the features of the UDF !
  14. just learning the UDF (as well as AutoIt), so 'brute force' is sometimes the only way I know how to do things - learning more as I go, in fact, I just put in If _SoundPos($aSound, 2) >= _SoundLength($aSound, 2) Then as I found that in the help file. I'll go look into _SoundStatus
  15. Just had another one. 1. Copied the file to a temp folder 2. Stopped the player (still going in SciTE as I am looking for ConsoleWrite stuff to try catching this - sadly, nothing interesting...) 3. Restarted the player in SciTE (so exact code) 4. Selected the temp folder (which then loaded only the one file) Played correctly. Because of that, I feel like an ID3 change is really not going to help on this one. I didn't do anything to the file other than copy/paste to the other location. Other thoughts? Any way I can put some tracking in to figure it out? I would rather it be BROKEN and/or at least duplicatable - I hate intermittent problems!
  16. I'll look at that. I'm not using the ID3 for anything (unless _SoundPlayer looks at them, etc), so never considered that. Haven't had any 'silent' ones in awhile (and didn't write down the culprits earlier as I thought it was my code...), so I will be sure to check on the next one. Thanks for the tip.
  17. After years of wanting a replacement for 'Media Player' as a background player (and suffering the last time with it picking the same 'random' songs over and over...) - I decided to make something in AutoIt as a 'relaxing' project. Within about an hour I had a nice working start and was playing music, thanks to _SoundPlay, FileOperations.au3 and gui tools. I now play truly random songs from my folder and NEVER repeat until the list has been gone through completely (should have done this LONG ago!) However, I'm getting the occasional song that comes up with no sound. I've checked the file, works fine in MP as well as re-running it in my program (as the only selected song). Code is simple - needs a lot of work to be 'releasable' (including some code to reload the files and/or {more likely} a database... - hey, it is 0.0.0.1!), but it suits my purpose well, for now (I've got about 300 hours of songs, so a bit of time before worrying about that). But, these 'silent' songs are driving me crazy! Any ideas welcome!
  18. I knew there was something else I wanted to say in that post - I don't have the BETA software (not exactly sure how to run it separately/differently than released stuff) and am running behind on a schedule right now - so, no, I did not run that directly. Thought I looked through it well enough and didn't see that a non-function won't display - sorry, missed that. Seems all the bases are covered on this one - thanks again.
  19. I think that works great - though I would still, personally, prefer ; current line If Not IsFunc($hUser_Func) Then GUICtrlSetState($cUser_Func, $_ARRAYCONSTANT_GUI_DISABLE) ; new line (or equivalent) If Not IsFunc($hUser_Func) Then GUICtrlSetState($cUser_Func, $GUI_HIDE) Reasoning; 1. If it is a coder looking at the display, they already know they can put in a function if they want to, and having a button they can't push does nothing for them anyway. 2. If it is a 'public' view where a coder allows the Exit Script button (in the new version), the user also does not need a button they can't push that has wording they don't understand and/or doesn't relate to their situation (causes frustration and Tech Support questions...). 3. I don't like having buttons I can't change wording or functionality of (simply, 'redundant') being on screen (or, is that obvious???) Yeah, that works better than mine (not surprised as you understand that code inside/out) - I tested both versions against all numbers 'around' 10,000, using various start digits, etc. - your code worked, mine missed 'sometimes'.......
  20. Note that I'm not looking to hide ALL the buttons, as, in my scenario, I am showing the array (a list of 'exceptions' in my case) and the user may want to save it off, print it, etc. so they can work with it bit-by-bit later (I considered just opening Notepad, though the Array looks nicer) I only want to hide the User Function and Exit Script buttons - the 'Copy' ones, in my case, have value (i.e., please consider the mod for $iFlags to have a couple more options - though I totally understand and agree that it is impossible to 'option' everything - I think that perhaps one to show/not the Exit Script button and {somehow - automatically or matching to the Exit one?} not showing the Function button if there is no function programmed) Thanks for the kudos and for taking the suggestions under consideration.
  21. That fixed that issue - now, I get all the data (yeah). As an 'addition', I did the following mod; Func _ArrayDisplayNoExit(Const ByRef $avArray, $sTitle = Default, $sArray_Range = Default, $iFlags = Default, $vUser_Separator = Default, $sHeader = Default, $iMax_ColWidth = Default, $iAlt_Color = Default, $hUser_Func = Default,$bPublic = FALSE) ;**************** insert this at the bottom of the Create buttons section ~ line 280 If $bPublic Then GUICtrlSetState($cData_Label,$GUI_hide) GUICtrlSetState($cUser_Func,$GUI_hide) GUICtrlSetState($cExit_Script,$GUI_hide) EndIf This allows me to use this function to display information to the public - more like the old function. I was using (and prefer the look of) GUICtrlCreateList, however, in larger searches, it is extremely slow to display (with 30,000+ records, GUICtrlCreateList takes over 13 minutes). Using _ArrayDisplay, showing the same data is around 15 seconds, however, it is not desirable to have the User Function and Exit Script buttons showing, thus, the above small mod (I considered also shrinking the size of the GUI window, though felt the empty space was not 'bad' enough to add that). Another thing I found is that the splash dialog does not work in the current (nor mod above) version. The problem is that, in my scenario (1D array), $iSubItem_End and $iSubItem_Start are both 0 and in the current version If $iVerbose And ($iItem_End - $iItem_Start) * ($iSubItem_End - $iSubItem_Start) > 10000 Then will ALWAYS result in 0 #include <Array.au3> Global $aTestArray[20001] For $i = 0 To 20000 $aTestArray[$i] = 1 Next _ArrayDisplay($aTestArray, "Splash Test for > 10000 records", "", 8) checking values (put this in just before the "Display splash dialog if required" section ConsoleWrite("$iItem_End is " & $iItem_End & @lf & "$iItem_Start is " & $iItem_Start & @lf & "$iSubItem_End is " & $iSubItem_End & @lf & "$iSubItem_Start is " & $iSubItem_Start & @lf) shows However, changing this section (~ line 194 of UDF) clears it up (may not be the best way, but it works for me - I did not test 2D arrays); ; Display splash dialog if required ; mod by TechCoder to avoid multiplying by 0 on 1D array Local $iSubItem_Total If $iSubItem_End > 0 Then $iSubItem_Total = ($iSubItem_End - $iSubItem_Start) Else $iSubItem_Total = 1 ; avoid multiplying by 0 EndIf If $iVerbose And ($iItem_End - $iItem_Start) * $iSubItem_Total > 10000 Then SplashTextOn("ArrayDisplay", "Preparing display" & @CRLF & @CRLF & "Please be patient", 300, 100) EndIf Those who have never felt the sting of this whip have never coded! EDIT: Fixed Display splash mod - it would have broken things too!
  22. >Running:(3.3.10.2): #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=ArrayDisplayTest.exe #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> Local $List[10] $List[0] = "JPM" $List[1] = "Holger" $List[2] = "Jon" $List[3] = "Larry" $List[4] = "Jeremy" $List[5] = "Valik" $List[6] = "Cyberslug" $List[7] = "Nutster" $List[8] = "JdeB" $List[9] = "Tylo" _ArrayDisplay($List, "Test of _ArrayDisplay", "") ; 10 rows, all data _ArrayDisplay($List, "Test of _ArrayDisplay", "7") ; 8 rows, no data _ArrayDisplay($List, "Test of _ArrayDisplay", "7:") ; 3 rows, no data _ArrayDisplay($List, "Test of _ArrayDisplay", "|7") ; 10 rows, no data ;_ArrayDisplay($List,"Test of _ArrayDisplay", "|7:" ) ; ==> Variable subscript badly formatted.: _ArrayDisplay($List, "Test of _ArrayDisplay", "7|7") ; 8 rows, no data _ArrayDisplay($List, "Test of _ArrayDisplay", "5:7") ; 3 rows, no data ;_ArrayDisplay($List,"Test of _ArrayDisplay", "|5:7" ) ; ==> Variable subscript badly formatted.: ;_ArrayDisplay($List,"Test of _ArrayDisplay", "7|5:7" ) ; ==> Variable subscript badly formatted.: _ArrayDisplay($List, "Test of _ArrayDisplay", "5:7|7") ; 3 rows, no data ;_ArrayDisplay($List,"Test of _ArrayDisplay", "5:7|5:7" ) ; ==> Variable subscript badly formatted.:
  23. When trying to download the zip from the referenced location, I get There is a link that comes up with it to 'Learn More' https://support.google.com/chrome/answer/4412392?p=ib_download_blocked&rd=1 (though I would not say it is very helpful!) Thought you would like to know.
  24. Not sure if this is the right place to report this - looked in the Bug Tracker, but that seems to be more oriented on the program itself. I run across various 'help file' bugs (as I'm still learning and reading/testing a lot of the examples) and didn't know where to report them, then I found this thread and, today, ran across a new doc bug. https://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetState.htm the line Local $iOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) sets the button outside the viewable area, which was set with GUICreate("Example", 420, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) (only 200 wide, but the button is set at 370) Let me know if there is a better place to report such things.
×
×
  • Create New...