Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VD.ahk crashes, doesn't run. #9

Open
4nur4g opened this issue Jan 19, 2022 · 2 comments
Open

VD.ahk crashes, doesn't run. #9

4nur4g opened this issue Jan 19, 2022 · 2 comments

Comments

@4nur4g
Copy link

4nur4g commented Jan 19, 2022

VD.ahk on launch crashes/closes immediately. However, "VD examples.ahk" runs/works fine. Am I doing anything wrong?

@FuPeiJiang
Copy link
Owner

if "VD examples.ahk" works fine, then you got it
VD.ahk was not meant to be ran, it was meant to be #Included by other scripts

because I can't, I need you to tell me
what should the README.md have included ? so that when you saw it, you wouldn't have had this confusion

Spoiler warning, click here to see more After you thought about it

would adding something like this work? :

VD.ahk will crash/close immediately, run "VD examples.ahk"

I just realized, you could have been misled by "no dependencies"
were you misled by "no dependencies" ?

My Attempt at Explaining

why are there 2 files VD.ahk and VD examples.ahk ?

say you have a project "app manager.ahk" that needs Virtual Desktop Capabilities,
you #Include VD.ahk into "app manager.ahk", then you have Virtual Desktop Capabilities (in code, this means VD methods)

"VD examples.ahk" is an example of such project: it #Includes VD.ahk, then it is able to call VD methods
like when you press Numpad2, it will call VD.goToDesktopNum(2)

numpad2::VD.goToDesktopNum(2)

you can say that VD.ahk is a class, or a library, or functions,
that said, VD.ahk and VD examples.ahk CAN be merged into 1 file,
but this would cause problems for people who want to use this script in their other scripts
read: pmb6tz/windows-desktop-switcher#47


why does VD.ahk close immediately ?

well, the program finished everything it had to do, so it exited
VD.ahk has no hotkeys, no code to run, it was done doing everything it had to do, so it exited

whilst "VD examples.ahk" does stuff : when you press a hotkey, it will do stuff

@4nur4g
Copy link
Author

4nur4g commented Jan 21, 2022

Thanks for the detailed explanation. Here's what went through my mind when I downloaded your script for personal use:

Seeing the file's name, "VD examples.ahk" gave an impression as if it's a demo file. The message box on launch further validated my assumption. It had detailed actions that one could do with the script.

Such instructions are generally put inside the "Read me" file. And then, the script just works after launch. One need not be greeted with documentation every time the script is launched.

I thought "VD examples.ahk" is the demo file and "VD.ahk" is the main script for the reasons mentioned above. Or in other words, I assumed: "VD.ahk" = "VD examples.ahk" - (Message box having a brief documentation)

I get that we can remove the message box by manually editing the concerned part of the script. However, users generally want the script to work without modifications.

Words of caution: I'm not a software engineer. I'm an ordinary man who thinks using common sense. Perhaps's it's the reason I misunderstood a seemingly obvious part.

Thanks again!
With Appreciation
Anurag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants