 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Tue Mar 14, 2006 2:06 pm Post subject: File Install with file with attrib A |
|
|
I am attempting to fileinstall a file that when checked for existance, returns A for being Archived. This causes errorlevel to be set on fileinstall. Is this normal, and if so, is there a workaround? _________________ my lame sig  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Tue Mar 14, 2006 2:10 pm Post subject: |
|
|
could you please post some code _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Tue Mar 14, 2006 2:25 pm Post subject: |
|
|
| Code: | FileSetAttrib, -A, C:\Program Files\AutoHotKey\*.ahk, 1, 1
File := FileExist("C:\Program Files\AutoHotKey\#Include\Functions\Misc\MemGetStats.ahk")
MsgBox %file%
Gui, Add, Edit, x6 y7 w460 h90, Lisence and product discription
Gui, Add, Button, vAccept gAccept x396 y107 w70 h20, Accept
Gui, Add, Edit, vInstallPath gInstallPath x6 y137 w460 h20, Path
Gui, Add, Button, vBrowse gBrowse x396 y167 w70 h20, Browse
Gui, Add, Button, gCancelInstall x6 y207 w100 h30, Cancel
Gui, Add, Button, vInstall gInstall x366 y207 w100 h30, Install
;Disable controls
GuiControl, Disable, Browse
GuiControl, Disable, Install
GuiControl, Disable, InstallPath
Gui, Show, x345 y232 h245 w474, AutoHotkey User Function Library Installer
Return
;--------------------------------------------------------------------------
Accept:
GuiControl, Enable, Browse
GuiControl, Enable, InstallPath
Return
;--------------------------------------------------------------------------
Browse:
SplitPath, A_AhkPath, , AhkDir
FileSelectFolder, SelectedDir, *%AhkDir%, 3
GuiControl, , InstallPath, %SelectedDir%
GuiControl, Enable, Install
Return
;--------------------------------------------------------------------------
InstallPath:
GuiControl, Enable, Install
Return
;--------------------------------------------------------------------------
Install:
Gui, Submit, NoHide
File := FileExist(InstallPath)
IfEqual, File,,
{
MsgBox, 1, Install Dir Error, The directory: %InstallPath% does not exist.`n`nPlease type or browse for an existing directory to install the User Function Library.
Return
}
;FileInstall, C:\Program Files\AutoHotKey\#Include\Functions\
; *****************************
; * Misc Fucntions
; *****************************
FileInstall, C:\Program Files\AutoHotKey\#Include\Functions\Misc\MemGetStats.ahk, %InstallPath%\#Include\Functions\Misc\MemGetStats.ahk, 1
; *****************************
; * Structure functions
; *****************************
FileInstall, C:\Program Files\AutoHotKey\#Include\Functions\Struc\AhkStrucLib.ahk, %InstallPath%\#Include\Functions\Struc\AhkStrucLib.ahk, 1
;Append "#include" to files that need them to function
FileAppend, #Include %InstallPath%\#Include\Functions\Struc\AhkStrucLib.ahk, %InstallPath%\#Include\Functions\Misc\MemGetStats.ahk
Return
;--------------------------------------------------------------------------
CancelInstall:
GuiClose:
Msgbox, 4, Exit Installer, Are you sure you would like to cancel the installation of the User Function Library?
IfMsgBox, Yes, ExitApp
Return
;--------------------------------------------------------------------------
F9::Reload
F10::ListVars |
This version of the code resets the attribute to N, but still the problem persists. Then I read "Note: Currently, the compression state of files cannot be changed with this command. " in the FileSetAttrib section of the help. and if the file is archived, its compessed, so does the compression cause the error? _________________ my lame sig  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Tue Mar 14, 2006 2:39 pm Post subject: |
|
|
AFAIK the A attribute doesn't mean that a file is archived or compressed, but that it "needs" to be archived, since it has been changed/created. BackUp software would remove this attribute to mark it as processed. This way incremental backups are created. Thus I guess this isn't the problem for your FileInstall _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Tue Mar 14, 2006 2:43 pm Post subject: |
|
|
Well what is, I copyed the paths for Param1 from the browser window so I couldnt get them wrong, double checked file names, doublechecked the second param for double \\ and so on, I have scoured this code a hundred times and found nothing. I have also tested FileInstall to make sure it wasnt buggy. Whats else can I do? _________________ my lame sig  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Tue Mar 14, 2006 2:44 pm Post subject: |
|
|
I read your code and couldn't find any bug. What is the exact problem? _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Tue Mar 14, 2006 2:46 pm Post subject: |
|
|
FileInstall Sets Error level, and it never occurs, causeing the fileappend to fail aswell _________________ my lame sig  |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Mar 14, 2006 2:48 pm Post subject: |
|
|
When we ask to show "some" code, we mean something showing the evidence of the problem, or, since you report it there, of the bug.
Often, isolating such problem with some lines shows that the problem may be between the chair and the keyboard...
I have not experience of FileInstall, but I find strange the line following them (FileInstall and FileAppend), starting with %InstallPath%.
If you intend to break the line in two for readability purposes (which is a good idea), you should put the comma at the start of the new line.
PS.: "Lisence and product discription" should be "Licence and product description" _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Tue Mar 14, 2006 2:53 pm Post subject: |
|
|
here is a shorted version | Code: | Gui, Add, Edit, vInstallPath gInstallPath r1 readonly w200, Path
Gui, Add, Button, vBrowse gBrowse, Browse
Gui, Add, Button, vInstall gInstall x+2, Install
Gui, Show,, AutoHotkey User Function Library Installer
Return
;--------------------------------------------------------------------------
Browse:
SplitPath, A_AhkPath, , AhkDir
FileSelectFolder, SelectedDir, *%AhkDir%, 3
If SelectedDir
GuiControl, , InstallPath, %SelectedDir%
Return
;--------------------------------------------------------------------------
Install:
Gui, Submit, NoHide
If not FileExist(InstallPath)
Return
FileInstall, C:\Program Files\AutoHotKey\#Include\Functions\Misc\MemGetStats.ahk, %InstallPath%\#Include\Functions\Misc\MemGetStats.ahk, 1
FileInstall, C:\Program Files\AutoHotKey\#Include\Functions\Struc\AhkStrucLib.ahk, %InstallPath%\#Include\Functions\Struc\AhkStrucLib.ahk, 1
FileAppend, #Include %InstallPath%\#Include\Functions\Struc\AhkStrucLib.ahk, %InstallPath%\#Include\Functions\Misc\MemGetStats.ahk
Return | *not tested*
I guess the InstallPath that is selected doesn't have the dirs:
\#Include\Functions\Struc
\#Include\Functions\Misc
I guess these have to be created first, because a filecopy might not copy a file if the path doesn't exist. and a filecopy is used for not compiled scripts in case of a FileInstall. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Tue Mar 14, 2006 3:05 pm Post subject: |
|
|
Creating the dirs makes all the difference! thank you so much toralf! But I think that the fact they must be created in advance is dumb! Can that be changed Chris? thanks _________________ my lame sig  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Wed Mar 15, 2006 1:58 pm Post subject: |
|
|
| It could be changed, but it might break existing scripts that want the command to fail when the directories do not exist. To avoid this, a new option would have to be added to FileInstall. However, since that change seems like it would be used by fewer than 1% of users, it seems too low in priority to add to the to-do list. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|