berto Posted September 22, 2007 Share Posted September 22, 2007 Hy. i have a little app that creats a file named file.abc on destop, now i want to implement some new features and i want the app to check is file.abc already exist, if yes then create file2.abc, and if file2.abc also exists the create file3.abc and so on. Can u help me? Link to comment Share on other sites More sharing options...
Developers Jos Posted September 22, 2007 Developers Share Posted September 22, 2007 Something like: $Filename = "file.abc" $count = 0 While FileExists($Filename) $count += 1 $Filename = "file" & $count & ".abc" WEnd ConsoleWrite('$Filename = ' & $Filename & @crlf ) Jos 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...
cdkid Posted September 22, 2007 Share Posted September 22, 2007 Lookup: FileExists While loops ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
berto Posted September 22, 2007 Author Share Posted September 22, 2007 Im stuck, here that part of code that i have problems with ;; Save bitmap to file #include <A3LClipboard.au3> #include <A3LScreenCap.au3> $check = _Clip_IsFormatAvailable($CF_BITMAP) If $check = true Then $ps = _Clip_GetData($CF_BITMAP) _ScreenCap_SetJPGQuality(100) _ScreenCap_SaveImage(@DesktopDir &"\Image.jpg", $ps) EndIf If $check = false Then MsgBox (0, "Info", "Nu ai nici un screenshoot in clipboard") Exit EndIf $Filename = "Image.jpg" $count = 0 While FileExists($Filename) $count += 1 $Filename = "Image" & $count & ".jpg" WEnd ConsoleWrite('$Filename = ' & $Filename & @crlf ) Link to comment Share on other sites More sharing options...
Developers Jos Posted September 22, 2007 Developers Share Posted September 22, 2007 Looks ok to me sofar .... what is it you are stuck with ? 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...
Blue_Drache Posted September 22, 2007 Share Posted September 22, 2007 Im stuck, here that part of code that i have problems with;; Save bitmap to file #include <A3LClipboard.au3> #include <A3LScreenCap.au3> $check = _Clip_IsFormatAvailable($CF_BITMAP) If $check = true Then $ps = _Clip_GetData($CF_BITMAP) _ScreenCap_SetJPGQuality(100) _ScreenCap_SaveImage(@DesktopDir &"\Image.jpg", $ps) EndIf If $check = false Then MsgBox (0, "Info", "Nu ai nici un screenshoot in clipboard") Exit EndIf $Filename = "Image.jpg" $count = 0 While FileExists($Filename) $count += 1 $Filename = "Image" & $count & ".jpg" WEnd ConsoleWrite('$Filename = ' & $Filename & @crlf )By your code, you're wanting us to spoon feed you. Sorry, it doesn't work that way. Jos and cdkid gave you everything you require with his example. Use your brain and modify it to your specific needs. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
berto Posted September 22, 2007 Author Share Posted September 22, 2007 It doesnt work man, it keeps replacing image.jpg, it doesnt matter i will do it myself. Link to comment Share on other sites More sharing options...
Developers Jos Posted September 22, 2007 Developers Share Posted September 22, 2007 Its important to try to understand the stuff Here is where the filecheck could be implemented (Untested): ;; Save bitmap to file #include <A3LClipboard.au3> #include <A3LScreenCap.au3> $check = _Clip_IsFormatAvailable ($CF_BITMAP) If $check = True Then $Filename = @DesktopDir & "\Image.jpg" $count = 0 While FileExists($Filename) $count += 1 $Filename = @DesktopDir & "\Image" & $count & ".jpg" WEnd $ps = _Clip_GetData ($CF_BITMAP) _ScreenCap_SetJPGQuality (100) _ScreenCap_SaveImage ($Filename, $ps) EndIf If $check = False Then MsgBox(0, "Info", "Nu ai nici un screenshoot in clipboard") Exit EndIf 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...
berto Posted September 22, 2007 Author Share Posted September 22, 2007 Thx, i took some part of code from above mixed with mine and i got something that works even better, thx 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