Jump to content

sandin

Active Members
  • Posts

    568
  • Joined

  • Last visited

Reputation Activity

  1. Like
    sandin got a reaction from oskrki in Msgbox and cancel button   
    $return_value = MsgBox(4,"Shutting Down", "This computer will do something in a 10 seconds. Press NO to cancel",10) Switch $return_value case 1 ;OK ---> Flags: 0, 1 MsgBox(0, "Return Value", "OK") case 2 ;cancel ---> Flags: 1, 3, 5, 6 MsgBox(0, "Return Value", "Cancel") case 3 ;abort ---> Flags: 2 MsgBox(0, "Return Value", "Abort") case 4 ;retry ---> Flags: 2, 5 MsgBox(0, "Return Value", "Retry") case 5 ;Ignore ---> Flags: 2 MsgBox(0, "Return Value", "Ignore") case 6 ;Yes ---> Flags: 3, 4 MsgBox(0, "Return Value", "Yes") case 7 ;No ---> Flags: 3, 4 MsgBox(0, "Return Value", "No") case 10 ;Try Again ---> Flags: 6 MsgBox(0, "Return Value", "Try again") case 11 ;Continue ---> Flags: 6 MsgBox(0, "Return Value", "Continue") EndSwitch
  2. Like
    sandin got a reaction from Deito in listview item on event?   
    I've made this so far:

    #include <GUIConstants.au3> #include <GuiListView.au3> #include <Misc.au3> $dll = DllOpen("user32.dll") $Form1 = GUICreate("Form1", 633, 447, 193, 125) $listt = GUICtrlCreateListView("", 72, 32, 441, 305) _GUICtrlListView_AddColumn($listt, "Item(s)", 120) _GUICtrlListView_AddItem($listt, "Something1") _GUICtrlListView_AddItem($listt, "Something2") _GUICtrlListView_AddItem($listt, "Something3") _GUICtrlListView_AddItem($listt, "Something4") _GUICtrlListView_AddItem($listt, "Something5") GUISetState(@SW_SHOW) While 1 if StringInStr(ControlGetFocus($Form1), "SysListView32") then If _IsPressed("01", $dll) Then Do Until NOT _IsPressed("01", $dll) $readings = GUICtrlRead($listt, 1) for $i = 0 to _GUICtrlListView_GetItemCount($listt) if _GUICtrlListView_GetItemSelected($listt, $i) = true Then $display = _GUICtrlListView_GetItemText($listt, $i) ExitLoop EndIf Next MsgBox(0, "", $display) EndIf EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE DllClose($dll) Exit case $listt MsgBox(0, "ok", "list") EndSwitch WEnd
    it can set listitem as a case, but only as double click, I can't figure how to set it as 1 click = case

    can anyone help?
  3. Like
    sandin got a reaction from Andreik in hook WinFast PVR Remote Control msges   
    first of all, many tnx to Bytencoder from Softpedia forum, he revealed his secret of intercepting Winfast PVR remote control keys. If you give any credit to this script it all goes to his nickname ;]

    The following script was made to intercept remote control keys from your WinFast PVR application.

    If you have Leadtek TV card, or WinFast PVR application, and remote control, you might find this useful, you could turn your TV card remote control into ultimate, distant PC control device.

    Please read the first few lines of the script, and choose first global variable, if you have WinFast PVR1, then use:
    Global $class = "Alec@Video(^0^)"

    if you have WinFast PVR2 or higher, then use:
    Global $class = "Alec@DVBT(>_<)"

    Also, this script was made tnx to register class function: http://www.autoitscript.com/forum/index.php?showtopic=79575


    #Include <WinAPI.au3> #Include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> ;choose the class which depends on your PVR you're using. PVR1 = "Alec@Video(^0^)", PVR2 and higher = "Alec@DVBT(^_^)" ;~ Global $class = "Alec@Video(^0^)" ;for pvr1 Global $class = "Alec@DVBT(^_^)" ;for pvr2 and up Global $enabled = true Global Const $CS_VREDRAW = 0x0001; Global Const $CS_HREDRAW = 0x0002; Global Const $CS_DBLCLKS = 0x0008; Global Const $CS_OWNDC = 0x0020; Global Const $CS_CLASSDC = 0x0040; Global Const $CS_PARENTDC = 0x0080; Global Const $CS_NOCLOSE = 0x0200; Global Const $CS_SAVEBITS = 0x0800; Global Const $CS_BYTEALIGNCLIENT = 0x1000; Global Const $CS_BYTEALIGNWINDOW = 0x2000; Global Const $CS_GLOBALCLASS = 0x4000; Global Const $CS_DROPSHADOW = 0x00020000; Global Const $CS_DEFAULTSTYLE = BitOR($CS_VREDRAW, $CS_HREDRAW) Global Const $CW_USEDEFAULT = 0x80000000 ;#CS Global Const $CURSOR_ARROW =32512 Global Const $CURSOR_IBEAM =32513 Global Const $CURSOR_WAIT =32514 Global Const $CURSOR_CROSS =32515 Global Const $CURSOR_UPARROW =32516 Global Const $CURSOR_SIZENWSE =32642 Global Const $CURSOR_SIZENESW =32643 Global Const $CURSOR_SIZEWE =32644 Global Const $CURSOR_SIZENS =32645 Global Const $CURSOR_SIZEALL =32646 Global Const $CURSOR_NO =32648 Global Const $CURSOR_APPSTARTING =32650 Global Const $CURSOR_HELP =32651 ;#CE _WinAPI_RegisterClassEx($class, "WindowCallback", 0, 0, -1, $CS_DEFAULTSTYLE) ;registering window class which is designed to recieve PVR's remote ctrl commands, and setting up a func. for hooking msges from that class (this last require a window, that's why we have next line) $hWnd = _WinAPI_CreateWindowEx(0, $class, "REMOTE CONTROL", $WS_OVERLAPPEDWINDOW, @DesktopWidth+500, @DesktopHeight+500, 0, 0, 0) ;creating a window with registered class (required, but doesn't need to be shown) $gui = GUICreate("test", 400, 300) ;creating main GUI $button1 = GUICtrlCreateButton("Disable", 10, 10, 100) ;button for disabling/enabling keys intercepting (actually, registering and unregistering required window's class $display_label = GUICtrlCreateLabel("", 10, 50, 380, 20, 0x01) ;label for displaying keys you stroke on your remote ctrl. GUICtrlSetFont(-1, 12, 800, -1, "Arial") GUISetState(@SW_SHOW) While 1 Local $nMsg = GUIGetMsg($gui) Switch $nMsg case $button1 if $enabled = true Then GUICtrlSetData($button1, "Enable") $enabled = false _WinAPI_UnregisterClass($class) ;unregistering class and... _WinAPI_DestroyWindow($hWnd) ;...killing window with registered class $hWnd = 0 Else GUICtrlSetData($button1, "Disable") $enabled = true _WinAPI_RegisterClassEx($class, "WindowCallback", 0, 0, -1, $CS_DEFAULTSTYLE) ;just like @ the top of the script $hWnd = _WinAPI_CreateWindowEx(0, $class, "REMOTE CONTROL", $WS_OVERLAPPEDWINDOW, @DesktopWidth+500, @DesktopHeight+500, 0, 0, 0) EndIf Case $GUI_EVENT_CLOSE _WinAPI_UnregisterClass($class) Exit EndSwitch Sleep(10) WEnd Func _WinGetClassName($hWnd) $x = DLLCall("user32.dll","int","GetClassName","hWnd",$hWnd,"str","","int",64) ;getting classname of a window If Not @error And $x[0] <> 0 Then Return $x[2] Return "" EndFunc Func WindowCallback($hWnd, $iMsg, $wParam, $lParam) ;callback func. for recieving msges Switch $iMsg Case $WM_CLOSE _WinAPI_UnregisterClass($class) Exit EndSwitch Switch $wParam ;set your functions here: (this is the part that recognize your remote ctrl keys) case 0 if $iMsg = 2560 Then GUICtrlSetData($display_label, "Power") EndIf case 1 ;dunno case 2 ;dunno case 3 GUICtrlSetData($display_label, "Full screen") case 4 GUICtrlSetData($display_label, "Vol +") case 5 GUICtrlSetData($display_label, "Ch. 1") case 6 GUICtrlSetData($display_label, "Ch. 2") case 7 GUICtrlSetData($display_label, "Ch. 3") case 8 GUICtrlSetData($display_label, "Vol -") case 9 GUICtrlSetData($display_label, "Ch. 4") case 10 GUICtrlSetData($display_label, "Ch. 5") Case 11 GUICtrlSetData($display_label, "Ch. 6") case 12 GUICtrlSetData($display_label, "Ch. UP") case 13 GUICtrlSetData($display_label, "Ch. 7") case 14 GUICtrlSetData($display_label, "Ch. 8") Case 15 GUICtrlSetData($display_label, "Ch. 9") case 16 GUICtrlSetData($display_label, "Ch. Down") case 17 GUICtrlSetData($display_label, "Switch to previous") case 18 GUICtrlSetData($display_label, "Ch. 0") case 19 GUICtrlSetData($display_label, "Enter") case 20 GUICtrlSetData($display_label, "Mute") case 22 GUICtrlSetData($display_label, "Display") case 27 GUICtrlSetData($display_label, "Audio") case 30 GUICtrlSetData($display_label, "Video") case 31 GUICtrlSetData($display_label, "Teletext") case 64 GUICtrlSetData($display_label, "Sleep") case 65 GUICtrlSetData($display_label, ". (Dot)") case 66 GUICtrlSetData($display_label, "Previous") case 67 GUICtrlSetData($display_label, "Play/Pause") case 68 GUICtrlSetData($display_label, "Next") case 69 GUICtrlSetData($display_label, "Time Shifting") case 70 GUICtrlSetData($display_label, "Stop") case 71 GUICtrlSetData($display_label, "Rec") case 72 GUICtrlSetData($display_label, "(M) SnapShot") case 73 GUICtrlSetData($display_label, "Boss Key") case 74 GUICtrlSetData($display_label, "Pic. in Pic.") case 75 GUICtrlSetData($display_label, "Red color") case 76 GUICtrlSetData($display_label, "Green color") case 77 GUICtrlSetData($display_label, "Yellow color") case 78 GUICtrlSetData($display_label, "Blue color") case 79 GUICtrlSetData($display_label, "Menu") case 80 GUICtrlSetData($display_label, "Cancel") case 81 GUICtrlSetData($display_label, "Chan. Surf") case 82 GUICtrlSetData($display_label, "[...]") case 83 GUICtrlSetData($display_label, "EPG") case 84 GUICtrlSetData($display_label, "Backward") case 85 GUICtrlSetData($display_label, "Forward") case 1011 ;DVD or sometimes FM, so disable and not use is the best solution case Else GUICtrlSetData($display_label, "key for case: " & @CRLF & $wParam & @CRLF & "is not defined...") EndSwitch Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;---------------------------------------------------------------------------------------- ; register class function and it's details/authors shown below ; link: http://www.autoitscript.com/forum/index.php?showtopic=79575 ;---------------------------------------------------------------------------------------- #cs _WinAPI_RegisterClassEx($sClassName, $sCallbackFunction, $hIcon=0, $hCursor=0, $iBkColor=$COLOR_BTNFACE, $iStyle=$CS_DEFAULTSTYLE) $sClassName - Classname $sCallbackFunction - WindowProc callback function $hIcon - Handle to a icon which will be be used as the window icon (Default = application icon) $hCursor - Handle to cursor which will be used as the window cursor (Default = arraow cursor) Use _WinAPI_LoadCursor() [also included with this UDF] to load a system cursor: $CURSOR_ARROW $CURSOR_IBEAM $CURSOR_WAIT $CURSOR_CROSS $CURSOR_UPARROW $CURSOR_SIZENWSE $CURSOR_SIZENESW $CURSOR_SIZEWE $CURSOR_SIZENS $CURSOR_SIZEALL $CURSOR_NO $CURSOR_APPSTARTING $CURSOR_HELP Example: _WinAPI_LoadCursor(0, $CURSOR_IBEAM) Do not use the $IDC_ constants declared in Constants.au3 $iBkColor - RGB color code of window background color $iStyle - Class style. A combination of these values: (Default = $CS_DEFAULTSTYLE) $CS_VREDRAW $CS_HREDRAW $CS_DBLCLKS $CS_OWNDC $CS_CLASSDC $CS_PARENTDC $CS_NOCLOSE $CS_SAVEBITS $CS_BYTEALIGNCLIENT $CS_BYTEALIGNWINDOW $CS_GLOBALCLASS $CS_DROPSHADOW Function: Creating a class which can be used with CreateWindowEx, and others Author: Original - amel27 Working version - Kip #ce Func _WinAPI_RegisterClassEx($sClassName, $sCallbackFunction="", $hIcon=0, $hCursor=0, $iBkColor=$COLOR_BTNFACE, $iStyle=$CS_DEFAULTSTYLE) If not $hIcon Then Local $aIcon = DllCall("user32.dll", "hwnd", "LoadIcon", "hwnd", 0, "int", $IDI_APPLICATION) $hIcon = $aIcon[0] EndIf If not $hCursor Then $hCursor = _WinAPI_LoadCursor(0,$CURSOR_ARROW) EndIf local $hWndProc = DLLCallbackRegister ($sCallbackFunction, "int", "hwnd;int;wparam;lparam") Local $pCallback = DllCallbackGetPtr($hWndProc) Local $tWndClassEx = DllStructCreate("uint cbSize;uint style;ptr lpfnWndProc;int cbClsExtra;int cbWndExtra;hwnd hInstance;hwnd hIcon;hwnd hCursor;hwnd hbrBackground;ptr lpszMenuName;ptr lpszClassName;hwnd hIconSm") Local $tClassName = DllStructCreate("char["& StringLen($sClassName)+1 &"]") DllStructSetData($tClassName, 1, $sClassName) DllStructSetData($tWndClassEx, "cbSize", DllStructGetSize($tWndClassEx) ) DllStructSetData($tWndClassEx, "style", $iStyle) DllStructSetData($tWndClassEx, "lpfnWndProc", $pCallback) DllStructSetData($tWndClassEx, "hInstance", _WinAPI_GetModuleHandle("")) DllStructSetData($tWndClassEx, "hIcon", $hIcon) DllStructSetData($tWndClassEx, "hCursor", $hCursor) DllStructSetData($tWndClassEx, "hbrBackground", _WinAPI_CreateSolidBrush(RGB_to_BGR($iBkColor))) DllStructSetData($tWndClassEx, "lpszClassName", DllStructGetPtr($tClassName)) DllStructSetData($tWndClassEx, "hIconSm", $hIcon) Local $aRet = DllCall("user32.dll", "dword", "RegisterClassExA", "ptr", DllStructGetPtr($tWndClassEx) ) Return $aRet[0] EndFunc Func _WinAPI_UnregisterClass($sClassName) Local $aRet = DllCall("user32.dll", "int", "UnregisterClassA", "str", $sClassName, "hwnd", _WinAPI_GetModuleHandle("")) Return $aRet[0] EndFunc Func _WinAPI_LoadCursor($hInstance, $iCursor) $GuiCursor = DllCall("user32.dll", "hwnd", "LoadCursor", "hwnd", $hInstance, "int", $iCursor) Return $GuiCursor[0] EndFunc Func RGB_to_BGR($BRG) $b = BitAND(BitShift($BRG, 16), 0xFF) $g = BitAND(BitShift($BRG, 8), 0xFF) $r = BitAND($BRG, 0xFF) Return "0x"&Hex($r,2)&Hex($g,2)&Hex($b,2) EndFunc
    ...would be great if some leadtek TV card owners could test ;]
  4. Like
    sandin got a reaction from robertocm in Ini Editor   
    This is application is meant for creating or editing INI files (which all programmers use for saving their program's data)



    You can add items (sections, keys, values), edit items, delete items, search for items or even drag items
    Adding items is very simple, if your current selected item is Section, then if you click ADD, you'll add section with 1 key and it's value, If you click ADD while your current selection is any key, then you'll add a key with it's value in the same section where your selected key is.
    Editing item's txt can be done with ENTER or F2 key (you can cancel with ESC while you're in "edit" mode)
    Deleting items can be done with key DEL
    You probably thinking "why did he used new child to set key's value it's annoying to expand every key to check/edit it's value", well if you turn TURBO mode on, then if you click ENTER while key item is selected, you go straight to edit it's value. And btw, I used new child to set as key's value so it could be easier to browse between keys and once you select Key or Value, bottom input will display the value, so you don't have to expand KEY if you wanna check it's value.
    You can create AU3 code by clicking bottom button "Generate AU3 Code" which will generate writing of your INI file, or you can go Right Click on any item and select whether Write or Read code, and by that, application will generate AU3 code for writing or reading that key or value which is selected.

    hotkeys:
    CTRL+N = New
    CTRL+O = Open
    CTRL+S = Save
    CTRL+SHIFT+S = Save As
    CTRL+F = Find
    ALT+A = Add item
    Application Key (Next to Windows key) = call "right click menu" on treeview

    I hope you'll like it and use it
    Please report any bugs if you find.

    Edit reason: fixed bug according to post #17 (thank you wraithdu) and added resizeable gui support according to wraithdu's suggestion (post #14)
    Edit 2: Added ability to create descriptions for any of the items in the treeview according to titoproject's suggestion (post #12)
    Edit 3: Fixed bug with "description of items", and reduced memory usage
    Sample.txt
    Ini_Editor.au3
  5. Like
    sandin got a reaction from genius257 in CPU Benchmark   
    This is application that calculates π (Pi) with 2 different formulas, in first one, the calculation of the formula should perform only 1 core of your CPU, and in the other formula both cores participate in calculation, unfortunately AutoIt is limited to only 15 decimals, though you will never need more than first 4 dec. of Pi number
    The less time in calculation you get, the better your CPU is, you may post your results here if you like.
    Even if it's not working perfectly (cores ratio is not perfect), at least it has pretty gui, and it was fun building it.
    Many thanks to MrCreator for his ControlHover UDF LINK, many thanks to UEZ for his text on GDI+ LINK, many thanks to monoceres for sharing his knowledge on GDI+, many thanks to n3nE for help, and everyone else on General Help and Support.



    script requires <GUICtrlSetOnHover_UDF.au3> by MrCreator which can be downloaded here, or from his thread: LINK

    Edit: I forgot to add: GDI+ is working even if the user is moving window
    Edit2: "Please wait" on the beginning of the script is obtaining CPU name, it's slow operation, so I gave it it's own gui before main gui pops up =.=
    Edit3: Changed single core test pi formula to the one Super PI uses LINK
    previous downloads: 140
    GUICtrlSetOnHover_UDF.au3
    CPU_Benchmark.au3
  6. Like
    sandin got a reaction from mLipok in Ini Editor   
    This is application is meant for creating or editing INI files (which all programmers use for saving their program's data)



    You can add items (sections, keys, values), edit items, delete items, search for items or even drag items
    Adding items is very simple, if your current selected item is Section, then if you click ADD, you'll add section with 1 key and it's value, If you click ADD while your current selection is any key, then you'll add a key with it's value in the same section where your selected key is.
    Editing item's txt can be done with ENTER or F2 key (you can cancel with ESC while you're in "edit" mode)
    Deleting items can be done with key DEL
    You probably thinking "why did he used new child to set key's value it's annoying to expand every key to check/edit it's value", well if you turn TURBO mode on, then if you click ENTER while key item is selected, you go straight to edit it's value. And btw, I used new child to set as key's value so it could be easier to browse between keys and once you select Key or Value, bottom input will display the value, so you don't have to expand KEY if you wanna check it's value.
    You can create AU3 code by clicking bottom button "Generate AU3 Code" which will generate writing of your INI file, or you can go Right Click on any item and select whether Write or Read code, and by that, application will generate AU3 code for writing or reading that key or value which is selected.

    hotkeys:
    CTRL+N = New
    CTRL+O = Open
    CTRL+S = Save
    CTRL+SHIFT+S = Save As
    CTRL+F = Find
    ALT+A = Add item
    Application Key (Next to Windows key) = call "right click menu" on treeview

    I hope you'll like it and use it
    Please report any bugs if you find.

    Edit reason: fixed bug according to post #17 (thank you wraithdu) and added resizeable gui support according to wraithdu's suggestion (post #14)
    Edit 2: Added ability to create descriptions for any of the items in the treeview according to titoproject's suggestion (post #12)
    Edit 3: Fixed bug with "description of items", and reduced memory usage
    Sample.txt
    Ini_Editor.au3
  7. Like
    sandin got a reaction from DickG in Ini Editor   
    This is application is meant for creating or editing INI files (which all programmers use for saving their program's data)



    You can add items (sections, keys, values), edit items, delete items, search for items or even drag items
    Adding items is very simple, if your current selected item is Section, then if you click ADD, you'll add section with 1 key and it's value, If you click ADD while your current selection is any key, then you'll add a key with it's value in the same section where your selected key is.
    Editing item's txt can be done with ENTER or F2 key (you can cancel with ESC while you're in "edit" mode)
    Deleting items can be done with key DEL
    You probably thinking "why did he used new child to set key's value it's annoying to expand every key to check/edit it's value", well if you turn TURBO mode on, then if you click ENTER while key item is selected, you go straight to edit it's value. And btw, I used new child to set as key's value so it could be easier to browse between keys and once you select Key or Value, bottom input will display the value, so you don't have to expand KEY if you wanna check it's value.
    You can create AU3 code by clicking bottom button "Generate AU3 Code" which will generate writing of your INI file, or you can go Right Click on any item and select whether Write or Read code, and by that, application will generate AU3 code for writing or reading that key or value which is selected.

    hotkeys:
    CTRL+N = New
    CTRL+O = Open
    CTRL+S = Save
    CTRL+SHIFT+S = Save As
    CTRL+F = Find
    ALT+A = Add item
    Application Key (Next to Windows key) = call "right click menu" on treeview

    I hope you'll like it and use it
    Please report any bugs if you find.

    Edit reason: fixed bug according to post #17 (thank you wraithdu) and added resizeable gui support according to wraithdu's suggestion (post #14)
    Edit 2: Added ability to create descriptions for any of the items in the treeview according to titoproject's suggestion (post #12)
    Edit 3: Fixed bug with "description of items", and reduced memory usage
    Sample.txt
    Ini_Editor.au3
  8. Like
    sandin got a reaction from amin84 in Create in Specific Tab   
    try this:

    #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 625, 445, 193, 115) $Tab1 = GUICtrlCreateTab(80, 80, 393, 209) $tabitem1 = GUICtrlCreateTabItem("Tab1") $tabitem2 = GUICtrlCreateTabItem("Tab2") $tabitem3 = GUICtrlCreateTabItem("Tab3") GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("Create Button to:", 112, 336, 137, 33, 0) $combo1 = GUICtrlCreateCombo("", 250, 340, 137, 33, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Tab1|Tab2|Tab3", "Tab1") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 $var = guictrlread($combo1) if $var = "Tab1" Then GUISwitch($Form1,$tabitem1) ElseIf $var = "Tab2" Then GUISwitch($Form1,$tabitem2) Else GUISwitch($Form1,$tabitem3) EndIf GUICtrlCreateButton("OK!", 300, 200) GUICtrlCreateTabItem("") EndSwitch WEnd
×
×
  • Create New...