0

I want it to save a text on the clipboard as a text document directly to the location open in 'exploler.exe' when shift + v is done. I can get the name of the open file, but not the full address.

            returnValue = getClipboardData()
            activeWindow = getActiveWindowName()
            openWindowIsFolder = False
            if activeWindow == "explorer.exe":
                openWindowIsFolder = True
                openWindowsFolderName = getActiveWindowTitle() 

            if  type(returnValue) == str:
                if openWindowIsFolder:
                    # if open windows name == exploler.exe
                    # String to text file.

                    # ????????\{openWindowsFolderName}\saveHere.txt
                    #                    ^
                    #                   ||
                    #how can i get previous from this location
                    print('str to file')
                else:
                    pressCtrlV()
  • You have to use [Shell.Applicaiton](https://learn.microsoft.com/en-us/windows/win32/shell/shell-application): [C# example](https://stackoverflow.com/questions/20960316/) and [VBscript example](https://www.vbsedit.com/scripts/desktop/explorer/scr_330.asp) – Daemon-5 Aug 30 '21 at 02:35
  • @Daemon-5 I don't understand what exactly should I do? Can you explain in a little more detail? What is 'shell.Aplicaton'? – Bilgehan Kalay Aug 30 '21 at 17:49
  • `Shell.Application` is object of `Windows Shell` interface from `Win32 API`. It's used to manage such object as Explorer folders, Internet Explorer controls and more. I gave you 3 links in my first comment. To solve the task you have to use Win32API calls from Python. Otherwise use external utlities or scripts (URLs of 1-s comment ). – Daemon-5 Aug 31 '21 at 02:52

0 Answers0