Jump to content

Leaderboard

Popular Content

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

  1. Without loop : Local $sString = "|Autoit| , |For| , |All|" & @CRLF & "|Thank| , |You| , |For| , |Help|" $DATA = Execute("'" & StringRegExpReplace($sString, "(?<=\|)\h*[^|&,\r\n]+\h*(?=\|)", "Alex' & Eval('__iCount') * Assign('__iCount', Eval('__iCount') + 1) + 1 & '") & "'") Msgbox(0,"", $DATA)
    1 point
  2. Jfish

    Instead GUICtrlSetOnEvent

    Hmmm. I think you are asking how to convert the button listeners from GuiCtrlSetOnEvent to a listener used in the while loop. If you look at my earlier post it does that. You would delete Opt("GUIOnEventMode", 1). Then in the while loop a button click would look like this: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $ButtonLogin; will fire when this button with this name is pressed logout() ; will do this when the button is pressed ; will do everything after "Case" and before the next case Case $GUI_EVENT_CLOSE Exit EndSwitch WEndI did not read all the code to figure out when you call login() vs. logout() based on pressing the $ButtonLogin button - but hopefully you can take it from here.
    1 point
  3. Inververs, I usually create an invisible label which has the required resizing parameters and then resize the UDF control to fit it in a WM_SIZE message handler: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> $hGUI = GUICreate("test", 400, 400, Default, Default, $WS_SIZEBOX) $cLabel = GUICtrlCreateLabel("", 20, 20, 200, 20) ; Label which will adjust with the GUI GUICtrlSetBkColor($cLabel, 0xFFCCCC) GUICtrlSetResizing($cLabel, $GUI_DOCKRIGHT + $GUI_DOCKLEFT + $GUI_DOCKHEIGHT + $GUI_DOCKTOP) $hCombo = _GUICtrlComboBox_Create($hGUI, "", 20, 20, 200) GUISetState() GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; Get label posiition and size and adjust child GUI to fit $aPos = ControlGetPos($hGUI, "", $cLabel) WinMove($hCombo, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]) EndFuncIncidentally, you should use normal addition for the resizing parameters, not BitOr as with Windows styles. M23
    1 point
  4. Jfish

    Instead GUICtrlSetOnEvent

    If I understand you correctly you don't want to use GUIOnEventMode. If so, you could just poll for events with a loop as below or are you trying to keep the GUIOnEventMode option but change its usage? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $button; your event you are listening for here [do something] ; your code to do something here Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
    1 point
  5. Concerning the discussion in this thread. I'm curious why some people deem using DllStructs for anything other than arguments for DllCall, wrong. If there is some technical reason why it's wrong or foolish or something I sure would like to hear it. In that thread it's mentioned that an ex code dev (probably valik) who was well clued up said it's wrong, and also trancexx who is also clued up and also ex dev mentioned it being a "no no". One thread is linked but no explanation is given, I'd be mighty obliged if anyone has the link to the other discussion. I'd like to point out also that DllStructs are used other than in DllCalls inside some standard UDF's,
    1 point
  6. Can you post a runnable script? It makes things much easier if we don't have to reinvent the wheel to figure out what's going wrong. Also, what is this supposed to be doing, because your comments don't go with the code inside them? ;~ GUI enable after login Opt("GUIOnEventMode",0) ;~ GUI enable after login
    1 point
  7. This is a work in progress. Your best bet for now is actually FileInstall.
    1 point
  8. Celtic88

    Reading a file .db

    #include <SQLite.au3> #include <Array.au3> _SQLite_Startup() _SQLite_Open(@ScriptDir & "\sync_config_original.db") Local $hQuery, $aRow, $Arraydb[1][3] _SQLite_Query(-1, "SELECT * FROM data;", $hQuery) While _SQLite_FetchData($hQuery, $aRow, False, False) = $SQLITE_OK $Arraydb[0][0] += 1 ReDim $Arraydb[$Arraydb[0][0] + 1][3] $Arraydb[$Arraydb[0][0]][0] = $aRow[0] $Arraydb[$Arraydb[0][0]][1] = $aRow[1] $Arraydb[$Arraydb[0][0]][2] = $aRow[2] If $aRow[0] = "feature_switch" Or $aRow[0] = "tango_storage" Then $Arraydb[$Arraydb[0][0]][2] = _base64decode($aRow[2]) WEnd _SQLite_QueryFinalize($hQuery) _SQLite_Close() _SQLite_Shutdown() _ArrayDisplay($Arraydb) Func _base64decode($sb64string) Local $a_call = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sb64string, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $a_call[0] Then Return SetError(1, 0, "") Local $a = DllStructCreate("byte[" & $a_call[5] & "]") $a_call = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sb64string, "dword", 0, "dword", 1, "struct*", $a, "dword*", $a_call[5], "ptr", 0, "ptr", 0) If @error Or Not $a_call[0] Then Return SetError(2, 0, "") Return DllStructGetData($a, 1) EndFunc ;==>_base64decode
    1 point
  9. Jos

    AutoIt Snippets

    -or- just add this in your properties file assuming you have the full version: save.session.advanced=1Jos
    1 point
  10. I just wrote you a nice reply and then IE crashed (I tried to create two tabs at the same time). Theres a reason I use chrome at home. Anyway. The key is to think backwards. Make the sub menu, then use it as the last parameter in AddMenuItem SubMenu = _GUICtrlMenu_CreateMenu MainMenu = _GUICtrlMenu_CreatePopup _GUICtrlMenu_AddMenuItem(MainMenu, Text, Id, SubMenu) Or look at loading menus from resources. That makes it very easy to edit menus and use them, and it's a pity AutoIt doesn't do more to support resources natively. sample MENU { MENUITEM "&Soup", 100 MENUITEM "S&alad", 101 POPUP "&Entree" { MENUITEM "&Fish", 200 MENUITEM "&Chicken", 201, CHECKED POPUP "&Beef" { MENUITEM "&Steak", 301 MENUITEM "&Prime Rib", 302 } } MENUITEM "&Dessert", 103 } Thats a lot easier to visualize, and the code will be simpler too: $hMenu = LoadMenu(GetModuleHandle(0), "sample") Done Sorry about writing everything in pseudo code, I don't have AutoIt on this machine... Mat
    1 point
×
×
  • Create New...