#Include not including the file

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
goku usa
Posts: 2
Joined: 23 Jan 2022, 02:43

#Include not including the file

Post by goku usa » 23 Jan 2022, 02:50

Hi all,
I know this question has been posted many times. I've read many threads over last two days trying to solve my issue. But none of the fixes seem to be working for me.
I have a RandomBezier.ahk file saved on my desktop.
I also have a CaveKraken.ahk file saved on my desktop, which has the location in the first line. But I get an error that file can't be opened.


I'm very new so please bare with me.
Attachments
image.png
image.png (225.45 KiB) Viewed 582 times
Last edited by goku usa on 23 Jan 2022, 14:26, edited 1 time in total.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: #Include not including the file

Post by mikeyww » 23 Jan 2022, 08:37

You can use FileExist to see whether the file is found. If you saved the file to the common desktop instead of the user desktop, then the file will be in a different directory.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: #Include not including the file

Post by swagfag » 23 Jan 2022, 09:41

ur RandomBezier.ahk is actually probably RandomBezier.ahk.txt....

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: #Include not including the file

Post by mikeyww » 23 Jan 2022, 09:51

My Notepad displays the complete file name in the window title bar, but looking at both of the Notepad windows displayed in the post, it looks like you may be right! Easy test: check File Explorer for both the path and the complete file name.

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

Re: #Include not including the file

Post by boiler » 23 Jan 2022, 11:10

And when checking File Explorer, if your settings are to not show file extensions as I believe is weirdly the default setting, then look in the “Type” column and see whether it says “AutoHotkey Script” or “Text Document.”

amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: #Include not including the file

Post by amateur+ » 23 Jan 2022, 11:48

Code: Select all

Loop, Files, %A_Desktop%\RandomBezier*.*
	MsgBox, % "Its name is actually " . A_LoopFileName
return
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: #Include not including the file

Post by mikeyww » 23 Jan 2022, 11:57

Or:

Code: Select all

mask = RandomBezier*.*
For each, dir in [A_Desktop, A_DesktopCommon]
 Loop, Files, %dir%\%mask%
  MsgBox, Its path is actually:`n`n%A_LoopFilePath%
Return

amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: #Include not including the file

Post by amateur+ » 23 Jan 2022, 12:26

Yes, that is more reliable :).
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.

goku usa
Posts: 2
Joined: 23 Jan 2022, 02:43

Re: #Include not including the file

Post by goku usa » 23 Jan 2022, 14:23

swagfag wrote:
23 Jan 2022, 09:41
ur RandomBezier.ahk is actually probably RandomBezier.ahk.txt....
Oh my god. This is it. I had saved the file as RandomBezier.ahk so in the script, I had to write [directpath]RandomBezier.ahk.ahk

This fixed it. I'm sure there's many that can use this solution.

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

Re: #Include not including the file

Post by boiler » 23 Jan 2022, 14:44

goku usa wrote: I had saved the file as RandomBezier.ahk so in the script, I had to write [directpath]RandomBezier.ahk.ahk

This fixed it. I'm sure there's many that can use this solution.
I would hope no one would use that solution. Rather then change your script to include the file RandomBezier.ahk.ahk, you should rename the file to just RandomBezier.ahk. Again, you probably have it so that your files are displayed without extensions, so you don’t see what the full file name actually is.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: #Include not including the file

Post by swagfag » 23 Jan 2022, 15:16

yes :lol:

amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: #Include not including the file

Post by amateur+ » 23 Jan 2022, 15:19

@goku usa, just run this script:

Code: Select all

FileMove, %A_Desktop%\RandomBezier*.*, %A_Desktop%\RandomBezier.ahk
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.

Post Reply

Return to “Ask for Help (v1)”