LeHuynhNam Posted December 13, 2008 Share Posted December 13, 2008 i have some problems with file! they are: 1. how can i get a file name and i can rename it in its dir. For example: i want to changed D:\desktop.ini to D:\desktop.ini.bak 2. when i compiled scripts, it appeared "Invalid FileInstall() Function" how can i fix it? 3. i want to resize an image with its name to other dir, how can i do? Please Help me! THx a lot Link to comment Share on other sites More sharing options...
Andreik Posted December 13, 2008 Share Posted December 13, 2008 i have some problems with file! they are:1. how can i get a file name and i can rename it in its dir. For example: i want to changed D:\desktop.ini to D:\desktop.ini.bak2. when i compiled scripts, it appeared "Invalid FileInstall() Function" how can i fix it?3. i want to resize an image with its name to other dir, how can i do?Please Help me! THx a lot1. FileMove()2.post your code3.search on forum - there are many examples When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Robjong Posted December 13, 2008 Share Posted December 13, 2008 (edited) Hey,first of all, most of it can be found in the helpfile, for writing (and debugging) your scripts use SciTE4AutoIt (http://www.autoitscript.com/autoit3/scite/downloads.shtml) and then if you have an error, like you have with FileInstall you can post the error message SciTE4AutoIt generates.1.) you can use FileCopy or FileMove FileCopy("D:\desktop.ini", "D:\desktop.ini.bak")2.) This could be for alot of reasons, most common is that people dont know (or forget) that the 1st param of FileInstall must be a literal string. Obviously also the file must exist.$sFileDestination = 'file.txt' FileInstall("Path\To\File.txt", sFileDestination)3.) not sure what you mean here, might wanna search for GDI (or some else can answer this one) check this: http://www.autoitscript.com/forum/index.ph...2&hl=resizeEdit: link Edited December 13, 2008 by Robjong Link to comment Share on other sites More sharing options...
LeHuynhNam Posted December 13, 2008 Author Share Posted December 13, 2008 (edited) i'd searched carefully in this forum but i still have problem! may be i don't understand not much! 1) i used If FileExists($r1&":\autorun.inf") Then FileCopy($r1&"\desktop.ini",$r1&"\desktop.ini.bak") FileDelete($r1&"\desktop.ini[/codebox] but it can rename desktop.ini without delete desktop.ini 2) my scripts here: FileInstall(@ScriptDir&"\EzSkin\Skin.dat",@TempDir&"\Ezskin\", 1) FileInstall(@ScriptDir&"\EzSkin\0.bmp",@TempDir&"\Ezskin\", 1) FileInstall(@ScriptDir&"\EzSkin\1.bmp", @TempDir&"\Ezskin\", 1) FileInstall(@ScriptDir&"\EzSkin\2.bmp", @TempDir&"\Ezskin\", 1) but it still have "invalid FileInstall() function" 3) i had read this topic. In this topic i found [code_ImageResize("C:\WINDOWS\Web\Wallpaper\bliss.bmp", @ScriptDir & "\Bliss.jpg", 400, 300) i mean, my input image can change and i want the out put image should have the input image name (not default name like "Name.bmp" Edited December 13, 2008 by LeHuynhNam Link to comment Share on other sites More sharing options...
GEOSoft Posted December 13, 2008 Share Posted December 13, 2008 because the fileinstall() is invalid. You might take another look at the help file item.HintThe source file must be a string and not a variable so that the compiler can extract the filename to include. The source cannot contain wildcards.That includes macros like @ScriptDir.Hint 2. If it is in @ScriptDir then just pass it the file name George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
LeHuynhNam Posted December 13, 2008 Author Share Posted December 13, 2008 i have change to default like this: FileInstall("C:\Documents and Settings\ANHNAM\My Documents\Example\EzSkin\Skin.dat",@TempDir&"\Ezskin\", 1) FileInstall("C:\Documents and Settings\ANHNAM\My Documents\Example\EzSkin\0.bmp",@TempDir&"\Ezskin\", 1) FileInstall("C:\Documents and Settings\ANHNAM\My Documents\Example\EzSkin\1.bmp", @TempDir&"\Ezskin\", 1) but the msg box "invalid fileinstall() function" still appear Link to comment Share on other sites More sharing options...
Developers Jos Posted December 13, 2008 Developers Share Posted December 13, 2008 those statements are correct.. Show the rest of the code thats infront of these lines. 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...
LeHuynhNam Posted December 13, 2008 Author Share Posted December 13, 2008 (edited) here it is: #include <ComboConstants.au3> #include <GDIPlus.au3> #include <File.au3> #include<string.au3> #include <EzSkin.au3> #include <GuiComboBoxEx.au3> #include <GuiImageList.au3> #include <GuiConstantsEx.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <Inet.au3> #include <GuiListView.au3> #Include <Constants.au3> #include <WinAPI.au3> #include <NamedPipes.au3> #include <ModernMenu.au3>#include <File.au3> Const $AW_BLEND = 0x00080000 Const $AW_HIDE = 0x00010000 If Not FileExists(@TempDir&"\Ezskin")Then Do $l=DirCreate(@TempDir&"\Ezskin") Until FileExists(@TempDir&"\Ezskin") EndIf FileInstall("C:\Documents and Settings\ANHNAM\My Documents\Example\EzSkin\Skin.dat",@TempDir&"\Ezskin\", 1) FileInstall("C:\Documents and Settings\ANHNAM\My Documents\Example\EzSkin\0.bmp",@TempDir&"\Ezskin\", 1) FileInstall("C:\Documents and Settings\ANHNAM\My Documents\Example\EzSkin\1.bmp", @TempDir&"\Ezskin\", 1) i had compiled successfull 3 times at 1 st but now i can't compile it ?! Edited December 13, 2008 by LeHuynhNam Link to comment Share on other sites More sharing options...
Robjong Posted December 13, 2008 Share Posted December 13, 2008 (edited) Hey, 1.) If you want the file to still exist after backup use FileCopy if not then use FileMove If FileExists($r1&":\autorun.inf") Then FileCopy($r1&"\desktop.ini",$r1&"\desktop.ini.bak") ; or If FileExists($r1&":\autorun.inf") Then FileMove($r1&"\desktop.ini",$r1&"\desktop.ini.bak")oÝ÷ Ûa9*¶Æ¢v+ZV®¶sdfÆTç7FÆÂgV÷C´W¥6¶âb3#µ6¶âæFBgV÷C²ÂFV×F"fײgV÷C²b3#´W§6¶âb3#µ6¶âæFBgV÷C²Â¤fÆTç7FÆÂgV÷C´W¥6¶âb3#²b3C²æ&×gV÷C²ÂFV×F"fײgV÷C²b3#´W§6¶âb3#²b3C²æ&×gV÷C²Â¤fÆTç7FÆÂgV÷C´W¥6¶âb3#³æ&×gV÷C²ÂFV×F"fײgV÷C²b3#´W§6¶âb3#³æ&×gV÷C²Â¤fÆTç7FÆÂgV÷C´W¥6¶âb3#³"æ&×gV÷C²ÂFV×F"fײgV÷C²b3#´W§6¶âb3#³"æ&×gV÷C²ÂoÝ÷ Û|¨¹Æ§ºÇjØR¦X~í+ºÚ"µÍÚ[ÛYH Ù[K]LÉÝÂÌÍÜÒ[YÑ[HH ][ÝÐÎÌLÕÒSÕÔÉÌLÕÙXÌLÕØ[ÌLØÜË ][ÝÂÒ[XYÙTÚ^J ÌÍÜÒ[YÑ[KØÜ [È ][ÝÉÌLÉ][ÝÈ [ÈÑ[PÙS[YJ ÌÍÜÒ[YÑ[JK Ì BB[ÈÑ[PÙS[YJ ÌÍÜÒ[YÑ[JHÈSØØ[ ÌÍÜÞ]K ÌÍÜÞ ÌÍÜÞ[YK ÌÍÜÞ^WÔ]Ü] ÌÍÜÒ[YÑ[K ÌÍÜÞ]K ÌÍÜÞ ÌÍÜÞ[YK ÌÍÜÞ^ BT] ÌÍÜÞ[YH [È ÌÍÜÞ^[[ Edit: tags Edited December 13, 2008 by Robjong Link to comment Share on other sites More sharing options...
Developers Jos Posted December 13, 2008 Developers Share Posted December 13, 2008 Does this snippet also give the error? 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...
LeHuynhNam Posted December 13, 2008 Author Share Posted December 13, 2008 oh i found my mistake! i had 2 lines #include <file.au3> Sr for my mistake! thx all for helping Link to comment Share on other sites More sharing options...
Developers Jos Posted December 13, 2008 Developers Share Posted December 13, 2008 Install the Full SciTE4AutoIt3 installer, that will always run au3check by default which would have pointed you to this issue. 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...
LeHuynhNam Posted December 13, 2008 Author Share Posted December 13, 2008 #include <file.au3> $sImgFile = "C:\WINDOWS\Web\Wallpaper\bliss.bmp" _ImageResize($sImgFile, @ScriptDir & "\" & _FileBaseName($sImgFile), 400, 300) Func _FileBaseName($sImgFile); Local $szDrive, $szDir, $szFName, $szExt _PathSplit($sImgFile, $szDrive, $szDir, $szFName, $szExt) Return $szFName & $szExt EndFunc i want the $imgfile can be *.jpg or *.gif but when it was resize this image is *.bmp and the name of the image isn't changed How can i do Link to comment Share on other sites More sharing options...
Valuater Posted December 13, 2008 Share Posted December 13, 2008 That answer is here Return $szFName & $szExt you can change the "NAME ONLY" like this Return $szFName & ".jpg" **************** VERY IMPORTANT **************** Just because you change the "name" of the file... IT DOES NOT CHANGE THE FILE TYPE! it will not "load" as a jpg or any other name you give it 8) Link to comment Share on other sites More sharing options...
LeHuynhNam Posted December 14, 2008 Author Share Posted December 14, 2008 (edited) thank you so much, Valuater! You are very helpful!and Jos, thank you a lotInstall the Full SciTE4AutoIt3 installer, that will always run au3check by default which would have pointed you to this issue. Edited December 14, 2008 by LeHuynhNam 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