Jump to content

problem with file... function! need help


Recommended Posts

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

4m848p10.gif 

Link to comment
Share on other sites

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

1. FileMove()

2.post your code

3.search on forum - there are many examples

When the words fail... music speaks.

Link to comment
Share on other sites

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=resize

Edit: link

Edited by Robjong
Link to comment
Share on other sites

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 by LeHuynhNam

4m848p10.gif 

Link to comment
Share on other sites

because the fileinstall() is invalid. You might take another look at the help file item.

Hint

The 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

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

4m848p10.gif 

Link to comment
Share on other sites

  • Developers

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

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 by LeHuynhNam

4m848p10.gif 

Link to comment
Share on other sites

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 by Robjong
Link to comment
Share on other sites

  • Developers

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

#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

4m848p10.gif 

Link to comment
Share on other sites

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)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...