Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Schedule task online


  • Please log in to reply

#16
SleepyDude

SleepyDude

    Trusted Helper

  • Malware Removal
  • 4,975 posts

Hi,

 

I'm glad you solved the challenge. I tried to get the cookie using cURL and it didn't work, exporting the cookie from the browser seems to be the right move.

 

Regards.


  • 0

Advertisements


#17
Valentino14

Valentino14

    Member

  • Topic Starter
  • Member
  • PipPip
  • 16 posts

SleepyDude, 

 

one last question - how to run a .cmd file from Task Scheduler? The file works fine manually and I've tried to set in task scheduler using "Start a program" --> "cmd.exe" but it wouldn't work.... I thought this would be a no brainer but it keeps throwing errors. Anything particular which should be added as parameters or something similar?

 

Thanks!!

 

Alexandra


  • 0

#18
Valentino14

Valentino14

    Member

  • Topic Starter
  • Member
  • PipPip
  • 16 posts

SleepyDude, 

 

found the solution, it's described very well in:

 

http://myousufali.wo...task-error-0x1/

 

Cheers


  • 0

#19
SleepyDude

SleepyDude

    Trusted Helper

  • Malware Removal
  • 4,975 posts

Hi Alexandra,

 

SleepyDude, 

 

one last question - how to run a .cmd file from Task Scheduler? The file works fine manually and I've tried to set in task scheduler using "Start a program" --> "cmd.exe" but it wouldn't work.... I thought this would be a no brainer but it keeps throwing errors. Anything particular which should be added as parameters or something similar?

 

Thanks!!

 

Alexandra

 

You didn't post the error you got.

 

The batch should run fine if you point the task to c:\MyScript\GetData.cmd

 

I suspect the problem is that the script is assuming it will find cURL.exe on the current folder and when running from the Task Scheduler you don't know where it is unless you set the option mentioned on that link. It's always good idea to take care of that on the script itself including the following line after the setlocal command

cd /d "%~dp0"

The command above will change the current drive and folder to the one containing the script and related files.


  • 0

#20
Valentino14

Valentino14

    Member

  • Topic Starter
  • Member
  • PipPip
  • 16 posts

Hi, 

 

The solution put forward in this thread works very well for obtaining data from online sources. 

 

Since a short time however, the file that i'd like to obtain is not the correct one anymore however....

 

The link is. 

http://www.bnpparibasmarkets.nl/NL/ExcelExport.ashx?ListName=ProductList&config=ActiveProducts&st_search=smVUClJgyncg54s%2fXHulQrrA%2blYEamThFGaF9vbZiuJIg20zaZF6lNpn7UgiO%2b1w5X5yJSeb%2brJMuLVMD4lJuKs4HzFyqw2QkyMqQOuSjy8JZLSnGk721HD%2bIy0Nhwb0YIyOzcwVXKZFgAA9NssHoD0ujOsmAwJIX%2bIYEjGlSKe%2batJCRfo3YYJ8cFt81ytLMQQNr5HV6CyfX6UkR04utQ%2bTcc7TqcLKJHDpJcgJexKWarN5Ke5sJm4YFAqzV1BxaVT6JZ8fO0AvQkfkteXrPXsqHR3%2f0kXZ7%2bTMXP4ERlw%3d

Size is around 1.9mb but if i run the cURL script it yields a file of around 9.5mb in sice  :no:

 

The script with which i try to obtain it is:

 

@echo off
setlocal


:: cut time to only HH:MM:SS
set _TIME=%time:~0,8%
:: replace ':' by '_' because ':' isn't valid in file names
set _TIME=%_TIME::=_%
set FN=%date%-%_TIME%
:: File named: c:/Users/Barry van Oven/Dropbox/Data/RBS NL_yyyy-mm-dd-hh_mm_ss.xls
curl.exe -L -v -J -b cookiesRBSNL.txt -o "c:/Users/Barry van Oven/Dropbox/Data/RBS NL_%FN%.xls" "http://www.bnpparibasmarkets.nl/NL/ExcelExport.ashx?ListName=ProductList&config=ActiveProducts&st_search=smVUClJgyncg54s%2fXHulQrrA%2blYEamThFGaF9vbZiuJIg20zaZF6lNpn7UgiO%2b1w5X5yJSeb%2brJMuLVMD4lJuKs4HzFyqw2QkyMqQOuSjy8JZLSnGk721HD%2bIy0Nhwb0YIyOzcwVXKZFgAA9NssHoD0ujOsmAwJIX%2bIYEjGlSKe%2batJCRfo3YYJ8cFt81ytLMQQNr5HV6CyfX6UkR04utQ%2bTcc7TqcLKJHDpJcgJexKWarN5Ke5sJm4YFAqzV1BxaVT6JZ8fO0AvQkfkteXrPXsqHR3%2f0kXZ7%2bTMXP4ERlw%3d"

I've tried recopying the cookies but to no luck unfortunately. 

 

Any other suggestions you may have?

 

Thanks!

Alexandra


  • 0

#21
SleepyDude

SleepyDude

    Trusted Helper

  • Malware Removal
  • 4,975 posts

Hi Alexandra,

 

Try this:

curl.exe -L -v -J -o Report.xls "http://www.bnpparibasmarkets.nl/NL/ExcelExport.ashx?ListName=ProductList&config=ActiveProducts&st_search=smVUClJgyncg54s%%2fXHulQrrA%%2blYEamThFGaF9vbZiuJIg20zaZF6lNpn7UgiO%%2b1w5X5yJSeb%%2brJMuLVMD4lJuKs4HzFyqw2QkyMqQOuSjy8JZLSnGk721HD%%2bIy0Nhwb0QwxS7ZQE3YyUY0n6m9pR1Q9a3QsFc%%2flapbdcFcnQDRDMEMuxQK2uH%%2bCANjYApBmxZ1TwDMwLckpQiOYv%%2fnOgOWdAw6W%%2bbAqUqiYpe9GECGaVkqRQT6e6nSAum%%2f258rgUpOT1E1QtvUa3dNYYE8ai%%2bJ%%2bWfkFpsw%%2bnhp388m0%%2bJ6fjtrJINLRYz6mV8ChJSyhi9s7RYtPWuDf9Jkhuw%%2f%%2bONpburkeNaRplF3cPTaK9yzA5E4TL8bdyAeBJlRZdtfsNX1nZ8fPh2%%2bfrl0O6JDeXbEAVpAHgKXxRPY%%2b5xI3DcGK%%2fgkZ%%2bYpBvpHlvGJGeI%%2blg8Vt4FTGciqTUQiPq0YL9xTZI6kLUV2CbuWSx0lVCiC1HSjr85KxeubNGVN7NGNqwnvDjUlBMgRgYXbYjTvAp8DhOoyke%%2fpT%%2fRvMsTxDs0nvIvR7oaJSqtgO%%2fZcBqdk5ltE7HOUpTeMAbo6UGQVESfG0%%2fiQncdSRjNf%%2bhHm5zEGTbwxapa46I7bkBJ6VOFHz7f1kgr4XCrI042ZDKUZf0%%2bgF954VO5%%2fKOIuSWKt2W1XfmF3NkJOkf3s2z5af34paZkf215Y3iigqX2cDF2XCeHsr%%2fhPleZHmlaHpf9bQZCOlomSRP8%%2btIevuyT32XCYsO7Knc%%2fXE%%2bacCcQtPS31x6whTlVt9CNa%%2fpGeqPf%%2fB407g4N%%2frm4sbEKHARmAnBquUTKf%%2b46p3K%%2f5Efgm9yCCpw6gHGgpSot7meJ1J6lwvKqPwd1eLg%%2fpME4D5gL2y97zIhZQq2H27Ndb37wm8ISy3a2%%2fkzW5qpLaEdnZ57pNjjR%%2fsHpeMOBOnePqTVIN8zYLyo"

The output is actually an html file that excel converts to a table and not a real xls file.


  • 0

#22
Valentino14

Valentino14

    Member

  • Topic Starter
  • Member
  • PipPip
  • 16 posts

Hi SleepyDude,

 

Thanks for your help upfront! Not sure how you’ve transformed the download code but that’s already impressive ;-)

 

I’ve tried the code exactly as suggested by you, but it downloaded only part of the file rather than the complete file (although the size was larger, 3.5 mb rather than 1.9mb for a manually downloaded (complete) file…) and not in the right format/location.

Therefore, I’ve integrated your code as part of the more elaborate code we’ve developed so far, for it to save (the full file file) in the right location and according to the format which I need. This did however not work at all L Please see the code below:

@echo off
setlocal


:: cut time to only HH:MM:SS
set _TIME=%time:~0,8%
:: replace ':' by '_' because ':' isn't valid in file names
set _TIME=%_TIME::=_%
set FN=%date%-%_TIME%
:: File named: c:/Users/Barry van Oven/Dropbox/Data/RBS NL_yyyy-mm-dd-hh_mm_ss.xls
curl.exe -L -v -J -o "c:/Users/Barry van Oven/Dropbox/Data/RBS NL_%FN%.xls" "http://www.bnpparibasmarkets.nl/NL/ExcelExport.ashx?ListName=ProductList&config=ActiveProducts&st_search=smVUClJgyncg54s%%2fXHulQrrA%%2blYEamThFGaF9vbZiuJIg20zaZF6lNpn7UgiO%%2b1w5X5yJSeb%%2brJMuLVMD4lJuKs4HzFyqw2QkyMqQOuSjy8JZLSnGk721HD%%2bIy0Nhwb0QwxS7ZQE3YyUY0n6m9pR1Q9a3QsFc%%2flapbdcFcnQDRDMEMuxQK2uH%%2bCANjYApBmxZ1TwDMwLckpQiOYv%%2fnOgOWdAw6W%%2bbAqUqiYpe9GECGaVkqRQT6e6nSAum%%2f258rgUpOT1E1QtvUa3dNYYE8ai%%2bJ%%2bWfkFpsw%%2bnhp388m0%%2bJ6fjtrJINLRYz6mV8ChJSyhi9s7RYtPWuDf9Jkhuw%%2f%%2bONpburkeNaRplF3cPTaK9yzA5E4TL8bdyAeBJlRZdtfsNX1nZ8fPh2%%2bfrl0O6JDeXbEAVpAHgKXxRPY%%2b5xI3DcGK%%2fgkZ%%2bYpBvpHlvGJGeI%%2blg8Vt4FTGciqTUQiPq0YL9xTZI6kLUV2CbuWSx0lVCiC1HSjr85KxeubNGVN7NGNqwnvDjUlBMgRgYXbYjTvAp8DhOoyke%%2fpT%%2fRvMsTxDs0nvIvR7oaJSqtgO%%2fZcBqdk5ltE7HOUpTeMAbo6UGQVESfG0%%2fiQncdSRjNf%%2bhHm5zEGTbwxapa46I7bkBJ6VOFHz7f1kgr4XCrI042ZDKUZf0%%2bgF954VO5%%2fKOIuSWKt2W1XfmF3NkJOkf3s2z5af34paZkf215Y3iigqX2cDF2XCeHsr%%2fhPleZHmlaHpf9bQZCOlomSRP8%%2btIevuyT32XCYsO7Knc%%2fXE%%2bacCcQtPS31x6whTlVt9CNa%%2fpGeqPf%%2fB407g4N%%2frm4sbEKHARmAnBquUTKf%%2b46p3K%%2f5Efgm9yCCpw6gHGgpSot7meJ1J6lwvKqPwd1eLg%%2fpME4D5gL2y97zIhZQq2H27Ndb37wm8ISy3a2%%2fkzW5qpLaEdnZ57pNjjR%%2fsHpeMOBOnePqTVIN8zYLyo"

Is there anything I can add in this last code so that I’ll be able to add the full file?

Thanks as usual!

 

Alexandra


  • 0

#23
SleepyDude

SleepyDude

    Trusted Helper

  • Malware Removal
  • 4,975 posts

Hi Alexandra,

 

The file I get using Firefox and using cURL is the same, most likely I choose something different on the site.

 

My suggestion:

  • download HTTPNetworkSniffer by NirSoft and install the tool
  • make sure you have all other programs closed to avoid extra stuff to be captured
  • access the website and clink on the page until you have selected the options you want but before clicking export as XLS
  • run HTTPNetworkSniffer (if I'm not mistaken it should start capturing imediatly)
  • back to the browser window click on the export option on the page
  • the HTTPNetworkSniffer window should show the correct URL used by the browser
  • Copy the URL and don't forget to replace all the single % with %% for use on the batch script

  • 0

#24
Valentino14

Valentino14

    Member

  • Topic Starter
  • Member
  • PipPip
  • 16 posts

Hi SleepyDude, 

 

Once again an excellent suggestion. Took some time to understand but now solves the issue, and the right file is downloaded again :-) And of course not to forget replacing the % ;-)

 

Thanks again, much appreciated

 

Alexandra 


  • 0

#25
SleepyDude

SleepyDude

    Trusted Helper

  • Malware Removal
  • 4,975 posts

Good :thumbsup:


  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP