Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/26/2016 in all areas

  1. gottygolly, How about this: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 500, 500) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $cDummy = GUICtrlCreateDummy() GUICtrlSetOnEvent($cDummy, "_Dummy") GUISetState() Local $aAccelKeys[1][2] = [["{LEFT}", $cDummy]] GUISetAccelerators($aAccelKeys) While 1 Sleep(10) WEnd Func _Dummy() MsgBox($MB_SYSTEMMODAL, "Hi", "LEFT key pressed") EndFunc Func _Exit() Exit EndFunc M23
    2 points
  2. Tumulus

    Switch vs. Select

    What are the differences between "Switch...Case...EndCase" and "Select...Case...EndCase"? They seem to have the same function to me. Are there situations in which one is more beneficial than the other?
    1 point
  3. BrewManNH

    Switch vs. Select

    Switch is comparing against one expression, and then using the Cases to determine which one matches it. Select is more like a compact form of If/Then and each case can be a totally unrelated test parameter to any other comparison being done. ; Switch example $a = 5 $x = 3 $b = "Dog" Switch $a Case 5 ;"do this" Case 4 ; "do something else" Case Else ; "nothing matched so do this" EndSwitch Select Case $a = 4 ; "do this" Case $x = 2 ; Do this instead Case $b = "Dog" ; Do something totally unrelated Case Else ; Do Nothing EndSelect
    1 point
  4. Melba23

    a small script help

    game123633, So you are falsifying the surveys for the "local biology Olympiad" at which you assisted to help you with your master's thesis? That is most definitely fraud and we will have nothing to do with it - I am sorely tempted to contact your university (yes, I can see where you are) and inform them of what you are trying to do. Thread closed. M23
    1 point
  5. i think you should look arround HotKeySet or _IsPressed samples here : https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm https://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm Edit : or not ^^
    1 point
  6. Thx for the info. Really nice tool
    1 point
  7. Thx for your nice demo video! I will fix it in the next update!
    1 point
  8. Added an example how to get the last cell of a column to the wiki.
    1 point
  9. meomeo192, I know of no way to copy directly from the ListView itself - but you can easily make a small dialog appear when an item is double-clicked: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <Array.au3> #include <GuiListView.au3> ; Create file $sFileName = "Data.txt" FileDelete($sFileName) $sString = "Checked|Column 1|Column 2|Column 3|Column 4|Column 5|Column 6|Column 7|Column 8" & @CRLF & _ "×|50.01.0001|160404134631346000|Other value|T3|alphachymotrypsin|Other value|C|alpha choay 4000IU" & @CRLF & _ "×|50.01.0003|160407154252435000|Other value|T2|Paracetamol|Other value|C|Acepron 250mg" & @CRLF & _ "|50.01.0005|160415135700860000|Other value|T3|Acenocoumarol|Other value|D|Acenocumarol WPW 4mg" & @CRLF & _ "|50.01.0006|160423064434487000|Other value|T3|Acetylcystein|Other value|D|Aceblue 100mg" & @CRLF & _ "×|50.01.0007|160430993168114000|Other value|T1|Acetylcystein|Other value|C|Aceblue 200mg" FileWrite($sFileName, $sString) ; Read file into a 2D array Local $aData _FileReadToArray($sFileName, $aData, $FRTA_NOCOUNT, "|") ; Create GUI $hGUI = GUICreate("Test", 800, 500) ; Create controls GUICtrlCreateLabel("Find:", 10, 30, 100, 20) $cInput = GUICtrlCreateInput("", 120, 30, 300, 20) $cSave = GUICtrlCreateButton("Save Check", 480, 10, 80, 20) $cFind = GUICtrlCreateButton("Find", 480, 30, 80, 20) $cFind8Only = GUICtrlCreateCheckbox(" Column 8 only", 600, 30, 200, 20) ; Create ListView $cListView = GUICtrlCreateListView("", 10, 100, 780, 300) _GUICtrlListView_SetExtendedListViewStyle($cListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES)) ; Add columns For $i = 0 To 8 _GUICtrlListView_AddColumn($cListView, $aData[0][$i], 100) Next ; Hide columns 3 & 6 _GUICtrlListView_HideColumn($cListView, 3) _GUICtrlListView_HideColumn($cListView, 6) ; Remove the header _ArrayDelete($aData, 0) ; Load the ListView with the data _GUICtrlListView_AddArray($cListView, $aData) ; Check the checkboxes to match the data For $i = 0 To _GUICtrlListView_GetItemCount($cListView) - 1 If $aData[$i][0] = "×" Then _GUICtrlListView_SetItemChecked($cListView, $i) _GUICtrlListView_SetItemText($cListView, $i, "") EndIf Next $cDummy = GUICtrlCreateDummy() GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cDummy $hDialog = GUICreate("Double Clicked Item", 300, 100) $cLabel = GUICtrlCreateEdit(GUICtrlRead($cDummy), 10, 10, 280, 80) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hDialog) EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Struct = $tagNMHDR and "int Item;int SubItem" from $tagNMLISTVIEW Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return Local $iRow = DllStructGetData($tStruct, 4) Local $iColumn = DllStructGetData($tStruct, 5) Local $iCode = BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) Switch $iCode Case $NM_DBLCLK $sText = _GUICtrlListView_GetItemText($cListView, $iRow, $iColumn) GUICtrlSendToDummy($cDummy, $sText) EndSwitch EndFunc Now you can copy from the dialog. M23
    1 point
  10. #Au3Stripper_Off #Au3Stripper_On ??
    1 point
  11. Like I see it @Overflow_ just want to write something inside an exe file and then read that, in the end an exe file is just a file like any other file. But if he want to past a parameter to an exe(program) then he must fallow @VIP suggestion. Regards Alien.
    1 point
  12. Emolas, Remember that the code itself is a very small fraction of the overall executable - the majority by far is the built-in interpreter. I have 2 compiled scripts: the first has some 8000 lines and a good few additional icons; the second is only a few hundred lines - the difference when compiled is a mere 50k. it is the price you pay for stand-alone executables. M23
    1 point
  13. Gianni

    AutoIt Snippets

    Day of the week MsgBox(0, '', "Today is " & _DayOfTheWeek()) MsgBox(0, '', "Johann Sebastian Bach was born on " & _DayOfTheWeek(1685, 3, 31)) ; Passing a date in the form (yyyy, mm, dd) it returns the day of the week Func _DayOfTheWeek($y = @YEAR, $m = @MON, $d = @MDAY) Local Static $aDaysOfWeek[7] = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] Local $fJulianDay = 367 * $y - Int(7 * ($y + Int(($m + 9) / 12)) / 4) - Int(3 * (Int(($y + Int(($m - 9) / 7)) / 100) + 1) / 4) + Int(275 * $m / 9) + $d + 1721028.5 Local $iDOW = Mod($fJulianDay + .5, 7) ; 0 = Monday . . . 6 = Sunday Return $aDaysOfWeek[$iDOW] EndFunc ;==>_DayOfTheWeek
    1 point
  14. Updated bundle version 1.9 is now available for download; fixed various command-line usage issues (file paths that got irretrievably lost, non-existent logfiles, and other regrettable oversights, ahem ). Nothing like a user-base to identify all kinds of hidden problems and situations I never tested for, so thanks, Deye! Note: I've noticed that commandline processing can occasionally still error out, but so far I haven't been able to identify the cause (it's a Heisenbug, so not reliably repeatable). When I find it, I'll post another update. @Deye: I'm not entirely clear what you are suggesting, but I'll do my best to clarify, based upon: Any change you make to the calls defined in MCfinclude's $CCkey have to be made before you run CodeScanner. So if the difference between your 20 machines is recognisable through what an existing macro, function call, or UDF returns (and in the latter case, this UDF is placed in Region Encryption2 above MCFCC_Init() so it can be accessed by MCFCC_Init()), then call it in your selected key ID ( = $CCkey index). Now you can generate machine-specific executables automatically with CodeCrypter.exe + commandline parameters, like so: codecrypter.exe /fhelloworld.au3 /b /e /k3 /dAlice <compile MCF0test.au3 and copy exe to Alice's machine> codecrypter.exe /fhelloworld.au3 /e /k3 /dBob <compile MCF0test.au3 and copy exe to Bob's machine> codecrypter.exe /fhelloworld.au3 /e /k3 /dCaroline <compile MCF0test.au3 and copy exe to Caroline's machine> ... In this example I'm using existing key ID=3 (macro @UserName) with different users. Each version will have a unique encryption that works only in environments where @username returns the exact string parsed after the /d parameter. If, alternatively, you're using the GUI, you would define that variable decryption key (Alice, Bob, etc.) under Tab Encrypt, under button "Decryptor." It is not a good idea to have a call in CCkey[2] alter the contents of CCkey[3] at runtime, as this region will itself be encrypted beforehand. You could however consider a scenario where you predefine in your key UDF an array of all valid responses (e.g., valid IP addresses), call your environment-query there (e.g., @IPaddress1), and add its response to that array, then apply an _ArrayUnique, and return _ArrayToString. If the IP is already in the list, its double is removed; if not, the returned string is different, causing decryption to fail. However, this is not as secure as generating individual exes on a per-case basis, as your key-generating UDF is itself only fixed-key encrypted, so could be vulnerable to attack. So the general idea is to keep MCFinclude unchanged from the way you set it up, and let the environment in which it is calling a $CCkey definition speak for you at runtime. Hope that clarifies matters.
    1 point
  15. guinness

    INIWrite File Locking

    Yeah, I hate it too when people tell me the right way of doing things.
    1 point
  16. Skysnake

    INIWrite File Locking

    Multiple users reading/writing seems to suggest database functionality? I hate it when people reply saying "you shouldn't be using that, use this" but I find myself there right now. why on earth would you want multiple users to write to something as limited as an INI file? INI files are incredibly simple and powerful, certainly not designed for a multi user read/write environment. Good luck
    1 point
  17. The Shortest way so far without the need of calling _Excel_RangeRead(): #include<Excel.au3> Local $oAppl = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oAppl,@ScriptDir&"\Excel1.xlsx") ; your workbook here Global Const $xlUp = -4162 Global Const $xlToLeft = -4159 With $oWorkbook.ActiveSheet $countRow = .Cells(.Rows.Count, "A").End($xlUp).row EndWith For $i = 1 To $countRow With $oWorkbook.ActiveSheet $lastColvalue = .Cells($i, .Columns.Count).End($xlToLeft).value EndWith MsgBox(0,"",$lastColvalue) Next Regards Alien.
    1 point
  18. @Deye: You're very welcome. Having thought about it a bit more, there's an alternative approach that you may wish to consider. Instead of user-query (tedious for users) or registry keys (could be access-monitored and copied to other machines), you could have your software read in a tiny ini file at startup, which just contains the registered user's name and other details. This doesn't even have to be encrypted. You'll have your software display its contents in a splashscreen or something, stating: Software license xyz for registered user so and so at company this and that, etc. Unbeknownst to the vile hackers that would attempt to rip off your work, you also send the exact same contents of that ini file to the serial key generator in MCFinclude, and use the returned serial as your decryption key. When anyone then tries to tamper with the contents of the ini file, changing even a single byte will produce a completely different serial, hence also a completely different decryption key, and nothing wil work anymore. The beauty would be that the user details would be plain for all to see, but any edit thereof will produce garbage code. Of course, you could make things even harder by encrypting the ini contents themselves as well, with some basic Crypt function. It's just because the registry is such an obvious place to store serials. Anyway, best of luck; hope it works out.
    1 point
  19. LOL don't hate this function, it's useful Don't worry make a mistake is the first step before make all working in the right way Thank you for support, it seems to work well now
    1 point
  20. Massi, I thought we had fixed that in 3.3.14.2 - the line should read: Local $vFirstElem = ( ($iDims = 1) ? ($aArray[$iBase]) : ($aArray[$iBase][$iColumn]) ) and yet it still reads the other way round when I look in the file. So it will crash when the column value is higher that the number of rows in the array - although it still checks the correct column if that is not the case. I am beginning to seriously dislike this function........... Looking in SVN it has been further modified to use an If structure rather than a ternary (which is a pity) and it is still the wrong way around. I will fix it now so it is ready for the next release. M23 Edit: And done - apologies again.
    1 point
  21. A little late but the solution is simple. Just remove the modeless style of the context menu. Include GuiMenu.au3 in the code in the first post and replace this line: Local $contextmenu = GUICtrlCreateContextMenu() with these three lines: Local $contextmenu = GUICtrlCreateContextMenu() Local $hCM = GUICtrlGetHandle( $contextmenu ) _GUICtrlMenu_SetMenuStyle($hCM, BitXOR(_GUICtrlMenu_GetMenuStyle($hCM), $MNS_MODELESS)) The A's will keep printing when you activate the context menu.
    1 point
  22. This is an example of a Thermometer Chart created with ExcelChart function. GreenCan _XLChart_Example_Thermometer Chart v3.0.zip
    1 point
×
×
  • Create New...