Jump to content

Open with OS default action


Guest hhravn
 Share

Recommended Posts

Guest hhravn

Is there a way to open a file with the OS default action? I have a list of mixed dirs and files, and would like to open them with the correct app on doubleclick. Right now i use

Run ('explorer ' & $ret)

Another thing: How do i react on doubleclick on listitems instead of normal click/select. The list displays some search results, and right now the files are executed on select :S

Link to comment
Share on other sites

Autoit unfortunately doesnt seperate the click and double click actions... Whatever does with single click will do with double click too... Search for any UDF's that might be using external DLL's to achieve that...I dont have any in mind but search....

Link to comment
Share on other sites

From CyberSlug:

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF); will change background color

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)
$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GUICtrlCreateInput("",20,200, 150)
GUICtrlSetState(-1,$GUI_ACCEPTFILES); to allow drag and dropping
GUISetState()
GUICtrlSetData($item2,"ITEM1",)
GUICtrlSetData($item3,"||COL33",)
GUICtrlDelete($item1)

$THRESHOLD = Number( RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "DoubleClickSpeed") )
Dim $TIMER = 0

Do
  $msg = GUIGetMsg ()
      
   Select
      Case $msg = $button
         MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
      Case $msg = $listview
         MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
     EndSelect
    
    If $msg = $GUI_EVENT_PRIMARYDOWN Then
        If $TIMER = 0 Then
            $TIMER = TimerInit()
        ElseIf TimerDiff($TIMER) <= $THRESHOLD Then
            MsgBox(4096,"", "DoubleClick Detected")
        Else
            $TIMER = 0
        EndIf
    EndIf
Until $msg = $GUI_EVENT_CLOSE

It's a little rusty... You'll notice how it catches a double click anywhere on the gui, not just the list... And sometimes you have to click 2 times really fast, and 1 slow... But it's the best I've seen yet...

FootbaG
Link to comment
Share on other sites

  • 1 month later...

Is there a way to open a file with the OS default action? I have a list of mixed dirs and files, and would like to open them with the correct app on doubleclick. Right now i use

Run ('explorer ' & $ret)

Another thing: How do i react on doubleclick on listitems instead of normal click/select. The list displays some search results, and right now the files are executed on select :S

Bit late but just read this thread. Using Rundll32.exe and url.dll call FileProtocolHandler. Note: only one space between Rundll32.exe Url,FileProtocolHandler and path\file.

Run (C:\Windows\System32\Rundll32.exe Url,FileProtocolHandler C:\a_textfile.txt)

FileProtocolHandler will not load .msc files, use mmc.exe instead

Run(C:\Windows\system32\mmc.exe C:\windows\system32\services.msc /s)

Hope this helps

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...