AutoHotkey Community

It is currently May 27th, 2012, 7:07 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: March 14th, 2006, 2:06 pm 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:10 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
could you please post some code

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:25 pm 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:39 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:43 pm 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:44 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
I read your code and couldn't find any bug. What is the exact problem?

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:46 pm 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
FileInstall Sets Error level, and it never occurs, causeing the fileappend to fail aswell

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:48 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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"

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:53 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 3:05 pm 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 15th, 2006, 1:58 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group