Dear Users! Please post bug reports about FDM here!

FDM access from command line in windows

Post a reply

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: FDM access from command line in windows

Re: FDM access from command line in windows

Post by Alex » Mon Mar 13, 2023 4:40 pm

Hello,
You can use the following command line to pass a URL to FDM:

fdm.exe URL

or

fdm.exe --url "URL"

Unfortunately, there is no way for now to add a download silently.

Would you like us to add such a feature?

FDM access from command line in windows

Post by Guest » Sat Mar 11, 2023 6:04 pm

Hi,
I want to know that is there a way to access fdm and it's functionalities(For example automatically download a file to a given destination) using command line. I was going through the old repository for fdm 3.X and I came across the following code which I think is used for accessing fdm. But unfortunately, non of these command line arguments are working for fdm 6.X.


Code: Select all

   for (int i = 0; i < m_parser.Get_ParameterCount (); i++)
   {
      LPCTSTR pszParam = m_parser.Get_Parameter (i);
      LPCTSTR pszValue = m_parser.Get_ParameterValue (i);

      if (_tcscmp (pszParam, _T("?")) == 0 && enPTT == Normal)
      {
         MessageBox (0, _T("fdm.exe [-fs] [-url=]url1 [-url=]url2 ...\n\n-fs - force silent mode.\nIf url contains spaces it should be in quotes.\n\nExample:\nfdm.exe -fs \"http://site.com/read me.txt\""), _T("Command line usage"), 0);
      }
      else if (_tcsicmp (pszParam, _T("fs")) == 0)
      {
         m_bForceSilent = TRUE;
      }
      else if ((_tcsicmp (pszParam, _T("URL")) == 0 || *pszParam == 0) && enPTT == Normal)
      {
         fsURL url;
         BOOL bUrl = IR_SUCCESS == url.Crack (pszValue) && pszValue [1] != _T(':');
         BOOL bTorrent = FALSE;

         if (bUrl == FALSE)
         {
            bTorrent = _tcslen (pszValue) > 8 &&
               0 == _tcsicmp (pszValue + _tcslen (pszValue) - 8, _T(".torrent"));

            if (_tcsstr(pszValue, _T("magnet:")) != 0)
            {
               bTorrent = TRUE;
            }
         }

         if (bUrl == FALSE && bTorrent == FALSE)
            continue;

         if (bTorrent)
         {
            static BOOL bBtI = vmsFdmAppMgr::MakeSureBtInstalled ();
            if (bBtI)
               AddTorrent (pszValue);
            continue;
         }

         if (m_bAnotherFDMStarted)
         {
            IWGUrlReceiver* pAdd = NULL;
            CoCreateInstance (CLSID_WGUrlReceiver, NULL, CLSCTX_ALL,
               IID_IWGUrlReceiver, (void**) &pAdd);

            if (pAdd)
            {
               CComBSTR url = pszValue;
               pAdd->put_Url (url);
               if (m_bForceSilent)
                  pAdd->put_ForceSilent (TRUE);
               pAdd->AddDownload ();
               pAdd->Release ();
            }
         }
         else
         {
            CFdmApp::_inc_UrlToAdd url;
            url.strUrl = pszValue;
            url.bForceSilent = m_bForceSilent;
            app->m_vUrlsToAdd.add (url);
         }
      }
      else if (_tcsicmp (pszParam, _T("nostart")) == 0)
      {
         m_bNeedExit = true;
      }
      else if (_tcsicmp (pszParam, _T("assocwithtorrent")) == 0 && enPTT == Elevated)
      {
         bool bAssoc = _tcscmp (pszValue, _T("0")) != 0;
         if (bAssoc)
         {
            _App.Bittorrent_OldTorrentAssociation (vmsTorrentExtension::GetCurrentAssociation ());
            vmsTorrentExtension::Associate ();
         }
         else
         {
            vmsTorrentExtension::AssociateWith (_App.Bittorrent_OldTorrentAssociation ());
         }
      }
      else if (_tcsicmp (pszParam, _T("assocwithmagnet")) == 0 && enPTT == Elevated)
      {
         bool bAssoc = _tcscmp (pszValue, _T("0")) != 0;
         vmsFdmUtils::AssociateFdmWithMagnetLinks (bAssoc);
      }
      else if (!_tcsicmp (pszParam, _T("RegServer")))
      {
         m_bNeedRegisterServer = true;
      }
      else if (!_tcsicmp (pszParam, _T("RegServerUserOnly")))
      {
         m_bNeedRegisterServerUserOnly = true;
      }
      else if (!_tcsicmp (pszParam, _T("UnregServer")))
      {
         m_bNeedUnregisterServer = true;
      }
      else if (!_tcsicmp (pszParam, _T("runelevated")))
      {
         m_bRunAsElevatedTasksProcessor = true;
      }
      else if (!_tcsicmp (pszParam, _T("ie")))
      {
         m_bInstallIeIntegration = true;
      }
      else if (!_tcsicmp(pszParam, _T("chrome")))
      {
         m_bInstallChromeIntegration = true;
      }
      else if (!_tcsicmp (pszParam, _T("installIntegration")) || !_tcsicmp (pszParam, _T("deinstallIntegration")))
      {
         std::vector <int> v;
         ReadIntVector (pszValue, v);
         bool bInstall = !_tcsicmp (pszParam, _T("installIntegration"));
         for (size_t i = 0; i < v.size (); i++)
         {
            if (bInstall)
               m_vBrowsersToInstallIntegration.push_back ((vmsKnownBrowsers::Browser) v [i]);
            else
               m_vBrowsersToDeinstallIntegration.push_back ((vmsKnownBrowsers::Browser) v [i]);
         }
      }
   }


Top