Jump to content

Recommended Posts

Posted (edited)

G'day everyone

I know how to make the script's location the working directory, but is it possible to make the script's LNK file's location the working directory? I mean, if my script is in C:foo and I have a shortcut to that script in D:bar, and the user moves that shortcut to E:blah, can I tell the script that E:blah should be the working directory?

In other words, can I detect the location of the LNK file that launched the script, and use that as the working directory?

I'm using Windows 7, if that is relevant.

Thanks

Samuel

Edited by leuce
Posted

I don't think it is possible.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Yes, as I understood he won't be creating the shortcut.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

I just realize that this is also the default behavior for a blank "Start in" parameter too >_< .

As I read the OP the user might move an existing shortcut, and if that shortcut is created with "Start in" = blank, then it still should work.

If the user creates a completely new shortcut, the default behavior is to set the "Start in" parameter to the directory the executable is located in. In this case, without accessing the shortcut, I see no way either to determine the shortcut location too.

Edited by KaFu
Posted

If the locations of shortcuts to a file are in the registry And they are easy to find knowing the path to the exe, Kafu's suggestion my still be valid, in that you might loop through all shortcuts, and modify them, so which ever shortcut it clicked the working directory would be set to its dir.

I think, maybe ?

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

The only way i can think of to make it work, would be to have another process running constantly, this process would detect any clicked items, if is a shortcut with a certain name, copy it's location, the main application would start and use this location as a path.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...