spyrorocks Posted May 6, 2006 Share Posted May 6, 2006 (edited) I noteced that Autoit does not have a Direxists() function, so me and Joke758 made one. I searched the fourms for this function and could not find it, so here it is... Requitements: Autoit version 3 Parameters: 1. Directory to check for existance Returns: 1 = Success 0 = Failure & Sets @error to 1 Example: If FileExists("C:\Windows") Then MsgBox(4096, "", "exists.") Else MsgBox(4096,"", "does not exist.") EndIf Actual Function: #include <Process.au3> func direxists($dir) ; Credits: Spyrorocks and Joke758 ;=======ENJOY======== $err = _RunDOS("dir " & $dir) if $err = 0 then return 1 else SetError(1) return 0 endif endfunc Small, But it works! Edited May 6, 2006 by spyrorocks [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2006 Developers Share Posted May 6, 2006 (edited) I noteced that Autoit does not have a Direxists() function, so me and Joke758 made one. I searched the fourms for this function and could not find it, so here it is... Requitements: Autoit version 3 Parameters: 1. Directory to check for existance Returns: 1 = Success 0 = Failure & Sets @error to 1 Example: $dir = direxists("C:\WINDOWS") if $dir then msgbox(0, "Dir Exists", "Directory Exists!") else msgbox(0, "Dir Exists", "Directory Does Not Exist!") endif Actual Function: #include <Process.au3> func direxists($dir) ; Credits: Spyrorocks and Joke758 ;=======ENJOY======== $err = _RunDOS("dir " & $dir) if $err = 0 then return 1 else SetError(1) return 0 endfunc Small, But it works! Did you test it ? Think an EndIf is missing This is even shorter: func direxists($dir) Return FileExists($dir) EndFunc Edited May 6, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted May 6, 2006 Share Posted May 6, 2006 (edited) nice... but If FileExists("C:\Windows") Then MsgBox(4096, "", "exists.") Else MsgBox(4096,"", "does not exist.") EndIf late again... JdeB got there first 8) Edited May 6, 2006 by Valuater Link to comment Share on other sites More sharing options...
spyrorocks Posted May 6, 2006 Author Share Posted May 6, 2006 Yah, Yah. I know it could have been done in three lines, but where is the fun in that? [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2006 Developers Share Posted May 6, 2006 Yah, Yah. I know it could have been done in three lines, but where is the fun in that?Yea right, why make live easy if you can do it the difficult way.... and mine works yours doesn't SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
spyrorocks Posted May 6, 2006 Author Share Posted May 6, 2006 it does too. try it. it works perfecly. Doing things in 3 lines is no fun. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2006 Developers Share Posted May 6, 2006 (edited) it does too. try it. it works perfecly. Doing things in 3 lines is no fun.Have you read my post? there is an EndIf missing so the function could error out.... Edited May 6, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted May 6, 2006 Share Posted May 6, 2006 it does too. try it. it works perfecly. Doing things in 3 lines is no fun.initial post...This post has been edited by spyrorocks: Today, 12:22 PMit does now8) Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2006 Developers Share Posted May 6, 2006 (edited) K.. now run this and see if you still think your function works nice and fast: #include <Process.au3> $x = TimerInit() ConsoleWrite(" t1:" & direxists1("c:\windows\system") & " time:" & TimerDiff($x) & @LF) $x = TimerInit() ConsoleWrite(" t2:" & direxists2("c:\windows\system") & " time:" & TimerDiff($x) & @LF) ; Func direxists1($dir) Return FileExists($dir) EndFunc ;==>direxists1 ; Func direxists2($dir) ; Credits: Spyrorocks and Joke759 ;=======ENJOY======== $err = _RunDOS("dir " & $dir) If $err = 0 Then Return 1 Else SetError(1) Return 0 EndIf EndFunc ;==>direxists2 EDIT: Fixed return Edited May 6, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted May 6, 2006 Share Posted May 6, 2006 @ spyrorocks please note... because of your signature with html links.. etc when ever i am on a thread that you have posted on... my mouse-pointer has an hour-glass showing the page has not finished loading... please fix that 8) Link to comment Share on other sites More sharing options...
spyrorocks Posted May 6, 2006 Author Share Posted May 6, 2006 I cant help your internet connection. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
RazerM Posted May 6, 2006 Share Posted May 6, 2006 yes but you could have courtesy and use less images/whatever. I myself do not have dialup but a lot of people do My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
spyrorocks Posted May 6, 2006 Author Share Posted May 6, 2006 I have dialup and it works fine for me. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 8, 2006 Moderators Share Posted May 8, 2006 I noteced that Autoit does not have a Direxists() function, so me and Joke758 made one. I searched the fourms for this function and could not find it, so here it is... Requitements: Autoit version 3 Parameters: 1. Directory to check for existance Returns: 1 = Success 0 = Failure & Sets @error to 1 Example: If FileExists("C:\Windows") Then MsgBox(4096, "", "exists.") Else MsgBox(4096,"", "does not exist.") EndIf Actual Function: #include <Process.au3> func direxists($dir) ; Credits: Spyrorocks and Joke758 ;=======ENJOY======== $err = _RunDOS("dir " & $dir) if $err = 0 then return 1 else SetError(1) return 0 endif endfunc Small, But it works!God, I'm so confused, why have even the 3 lines, when the function FileExists() does the same thing anyway? As your clearly showing in your example, your using FileExists() here and your Function name is called DirExists()... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
JerryD Posted May 8, 2006 Share Posted May 8, 2006 Errrr, maybe I'm missing something here, but won't all these functions return TRUE if a FILE exists that isn't a directory like the file "c:\WINDOWS\system32\drivers\etc\hosts" ? Maybe this would be a bit more reliable: Func DirExists ( $sDirPath ) If FileExists($sDirPath) AND StringInString(FileGetAttrib($sDirPath), 'D') Then Return 1 Else Return 0 EndIf EndFunc Even the DOS Shell calls would return true for the file quoted above. You'd want to add a " /D" parameter to the DIR command, but I don't see the need to shell out for this, and it's probably a lot slower too! J Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 8, 2006 Moderators Share Posted May 8, 2006 Errrr, maybe I'm missing something here, but won't all these functions return TRUE if a FILE exists that isn't a directory like the file "c:\WINDOWS\system32\drivers\etc\hosts" ? Maybe this would be a bit more reliable: Func DirExists ( $sDirPath ) If FileExists($sDirPath) AND StringInString(FileGetAttrib($sDirPath), 'D') Then Return 1 Else Return 0 EndIf EndFunc Even the DOS Shell calls would return true for the file quoted above. You'd want to add a " /D" parameter to the DIR command, but I don't see the need to shell out for this, and it's probably a lot slower too! JThat's a good point Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Simucal Posted May 10, 2006 Share Posted May 10, 2006 it does too. try it. it works perfecly. Doing things in 3 lines is no fun.I think the exact opposite is true. Doing things in as few lines as possible is fun. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
spyrorocks Posted May 11, 2006 Author Share Posted May 11, 2006 what ever. I just though i would try something. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now