Sign in to follow this  
Followers 0
IanN1990

[Solved] Detect Selected File/Icon and move it

4 posts in this topic

#1 ·  Posted (edited)

Hi,

I spent a few hours searching the forums today but didn't come up with much luck so i was wondering if anyone could point me into the right direction.

What i am trying to produce is the following two functions.

Get the file name when mouse hovers over it

and two move a file to the mouse location.

Edited by IanN1990

Share this post


Link to post
Share on other sites



You just gave me a great idea for the next office April fools joke XD


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

Hmm well the idea i had in mind was replacing my windows right-click context menu with my own on, "i started a topic on it a few days ago". Now i am looking to improve it more by adding in functions like "New Autoit.au3 File".

Making the file is the easy part but i would like it moved to where the mouse is "in this example where i right-clicked to make it"

The second part is allowing me to use software "Virus Scanners/Winrar", (I have already researched the shortcut/command lines to use these softwares) but they need the variable name "C:UsersUsernameDesktopFIle.au3" which is why i need a way to be able to get that information from hovering over a file.

Hope this extra info makes things a little clearer ;)

Share this post


Link to post
Share on other sites

I was working on this topic sense yesterday 3pm ^^ and this is what i have so far and thought i would share incase others needed it.

#Include <Clipboard.au3>
$ScreenSzie = wingetpos("[Class:Shell_TrayWnd]")
$ScreenSzie = @DesktopHeight - $ScreenSzie[3]

local $store[2]
local $pos1[2]
local $store1


while 1
   sleep(500)
   $pos = mousegetpos()
$Pos1[1] = round(($ScreenSzie - $pos[1])/50)
$Pos1[0] = round(($ScreenSzie - $pos[0])/75)


If Not($Pos1[1] == $Store[1]) or Not($Pos1[0] == $Store[0]) Then
$Store[1] = $Pos1[1]
$Store[0] = $Pos1[0]

ControlClick("Program Manager", "FolderView", "[Class:SysListView32]", "Left", 1, $Pos[0], $Pos[1])
   $CLVItem = ControlListView("[CLASS:Progman]", "FolderView", "SysListView321", "GetSelected")
   If $CLVItem <> "" and Not($CLVItem=$Store1) Then
   $Store1 = $CLVItem 
   $var = _ClipBoard_GetDataEx()
   ControlSend("Program Manager", "FolderView", "[Class:SysListView32]", "^c")
   ConsoleWrite(ClipGet() & @CRLF)
   _ClipBoard_SetDataEx($var)
   EndIf
EndIf
WEnd

What the code does is this.

Gets the size of your taskbar

Gets the size of your screen

Does some maths to get the size of your desktop

Runs it though a formula and if statement to make a mathematical grid to the size of icons (In my case Medium sized icons on 1366x768 screen)

When the mouse moves over a icon it control-clicks "selecting the icon"

ControlListView then gets the icon/file index number to stop it being clicked more then once when inside a grid (I tryed using "Get text" from Controllistview but it kept crashing explorer *Shrugs* if that did work it would be alot better then copy/pasting but i dont know how to fix that.

Only Aside from the listed condictions the desktop must be active but it should get you the file name for what what your mouse is hovering over.

Now to start on the second task.

The function

#include <File.au3>
_FileCreate($sFilePath)

Allows me to create a file but when i use Filegetpos / filesetpos (from the examples in help-file they dont work) and thats the only way i can think of making a file on the desktop and then moving it to where the mouse was.

Share this post


Link to post
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
Sign in to follow this  
Followers 0