Can't get FileInstall to work

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
troufas
Posts: 80
Joined: 16 Jan 2021, 13:58

Can't get FileInstall to work

Post by troufas » 13 Aug 2022, 04:07

Hello,

I have a script that i need to compile along with an image, so that when i press a button in the gui, the image pops up in the preview space on the gui.

I have this line on the autoexecute section of my script:

FileInstall, C:\Users\myname\Desktop\Autohotkey\images\play.bmp, A_WorkingDir\images\play.bmp

I compile the script, create the images folder on my desktop, then when i run the script and press the play button, no image shows and the folder is empty. If however i just copy paste the image from my pre-compiled images folder into the new one, then the button shows the image ok.

I was under the impression that fileinstall would extract the image in the folder i designated then use it from there, but i haven't managed to make that happen so far.

Any help?

gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: Can't get FileInstall to work

Post by gregster » 13 Aug 2022, 04:47

A_workingDir is a variable you want to evaluate while the rest of the file path is meant literally: %A_WorkingDir%\images\play.bmp
But you could probably leave that first part out anyway (About the Dest parameter: "It is assumed to be in %A_WorkingDir% if an absolute path isn't specified.").

TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Can't get FileInstall to work

Post by TAC109 » 13 Aug 2022, 04:49

You probably want

Code: Select all

 FileInstall, C:\Users\myname\Desktop\Autohotkey\images\play.bmp, %A_WorkingDir%\images\play.bmp
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe

troufas
Posts: 80
Joined: 16 Jan 2021, 13:58

Re: Can't get FileInstall to work

Post by troufas » 13 Aug 2022, 05:20

gregster wrote:
13 Aug 2022, 04:47
A_workingDir is a variable you want to evaluate while the rest of the file path is meant literally: %A_WorkingDir%\images\play.bmp
But you could probably leave that first part out anyway (About the Dest parameter: "It is assumed to be in %A_WorkingDir% if an absolute path isn't specified.").
I tried removing the %a_workingdir% but it still didn't work.
TAC109 wrote:
13 Aug 2022, 04:49
You probably want

Code: Select all

 FileInstall, C:\Users\myname\Desktop\Autohotkey\images\play.bmp, %A_WorkingDir%\images\play.bmp
I am sorry, but i don't see the difference.

TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Can't get FileInstall to work

Post by TAC109 » 13 Aug 2022, 17:45

I didn’t see that @gregster had replied first.

Check that your source and destination directories exist. FileInstall can throw an error, so insert code to test for this after the FileInstall command.

Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Can't get FileInstall to work

Post by boiler » 13 Aug 2022, 18:46

troufas wrote: I tried removing the %a_workingdir% but it still didn't work.
Did you also remove the \ that follows it so that it would be just images\play.bmp?

But if it didn’t work with the working directory correctly specified, it won’t work without it since you must have some other issue.

troufas
Posts: 80
Joined: 16 Jan 2021, 13:58

Re: Can't get FileInstall to work

Post by troufas » 14 Aug 2022, 03:00

i just tried with just a .txt file and it worked fine, so i assume it's some issue with the bmp. I will keep testing, if i can't work around it somehow.

Post Reply

Return to “Ask for Help (v1)”