Register
Page 1 of 4 123 ... Last
Results 1 to 10 of 36
  1. #1
    Aeriwen's Avatar
    Posts
    28
    Reputation
    16
    Tagged in
    11 Posts
    Add to this user's reputation

    Automating The Undermine Journal Addon Updates via Windows 7 Software.

    So, I got an itch. I wanted to make Windows 7 fetch The Undermine Journal Addon for my account. A simple thought really and the logical choice was using task scheduler to automate the process. I knew that I wanted something simple and that could preferably be used by anyone without installing additional software. Later I saw a method to do this with perl, but I decided to go ahead and release this for people who couldn't get that method to work or couldn't install perl or whatever.

    This will only work with newer versions of window like Windows 7, but it may work on Vista, I have no way to verify. It utilizes Powershell and Task Scheduler, both of which are integrated into the newer MS operating systems.

    For those that are interested in more information:

    Windows PowerShell - Wikipedia, the free encyclopedia
    Windows Task Scheduler - Wikipedia, the free encyclopedia

    Now to the meat.

    You'll need to create a text file and input this:

    Code:
    #This should be set your your base addon directory in wow
    $directory = "C:\Users\Public\Games\World of Warcraft\Interface\addons\"
    #fix powershell's idiotic notion working directory
    cd $directory
    # Download the file
    $object = New-Object Net.WebClient
    #your undermine addon link
    $url = 'http://your.addon.link.goes.here'
    $local = $directory + "\TheUndermineJournal.zip"
    $object.DownloadFile($url, $local)
    # Extract the file
    $shell_app = new-object -com shell.application 
    $filename = "TheUndermineJournal.zip" 
    $zip_file = $shell_app.namespace((Get-Location).Path + "\$filename") 
    $destination = $shell_app.namespace((Get-Location).Path) 
    $destination.Copyhere($zip_file.items(), 0x14)
    Edit the addon with the link provided on your account control addon feed at TUJ. It says "Download Your Addon Here." Just copy and paste it between the quotes where it says "http:\\your.addon.link.goes.here". Save the file as TUJ.ps1. Be sure that you are saving the file as ps1, and not ps1.txt. You may need to show file extentions to do that. And its good practice to always show those any way to avoid clicking deviously named executables. On Win7, click Organize > Folder and search options > View > Advanced settings and then uncheck "Hide extensions for known file types".

    I would just share the file and let you edit, but windows protects the user from downloaded scripts pretty aggressively.

    Place that file in your addon directory.

    Now we need to schedule its execution via task scheduler. Just search for task scheduler on the start menu if you don't know where it is. Heck, that's what I do, and I know where it is.

    Create a new task, name it whatever you like and add a description if you'd like. Schedule how often you'd like it to update. I do once a day at 12 am, repeating every 6 hours. But you can do whatever you like. On the settings tab you may want to ensure that you stop existing instances on the bottom of that tab as an extra safeguard. But really all that will happen if you set it up wrong is that it pulls the data too much. You can only pull TUJ addons 10 times a day.

    Under actions, chose start a program and copy and paste this and accept its interpretation. (Some of the command will show in different boxes.)

    Code:
    powershell.exe -windowStyle Hidden -Command "& 'C:\Users\Public\Games\World of Warcraft\Interface\addons\TUJ.ps1'"
    Save all that and you just need to do one final thing.

    Windows is pretty aggressive about blocking unsigned scripts and that is a good thing. You need to modify your script permissions in order to run even your own scripts.

    WARNING! SCARY COMMAND PROMPT AHEAD! WARNING! :P

    Type in powershell on the start menu, right click Windows Powershell and choose run as administrator. Copy this;

    Code:
    Set-ExecutionPolicy RemoteSigned
    
    And right click in the window to paste. Hit Enter and then type "y" and Enter again to accept the policy change. You can close the window.

    Ok, now we should be set to run the script.

    You can manually run it to make sure its working on the task scheduler. Just click run and there should be new files in your addon folder. The TUP addon .zip file and the extracted addon. (And ofcourse the script.)


    Ok, thats the down and dirty, and boy do I know its dirty. I may write up a more detailed guide with flashy photos or a video but I just wanted to get this out there as soon as possible.

    Let me know what you think, and if there is enough interest, I'll continue development.
    Last edited by Kathroman; January 17th, 2012 at 09:59 AM. Reason: Font color on last code block

  2. #2
    I'll definitely give this a shot as soon as TUJ is back up. Thank you very much!

  3. #3
    Freohr's Avatar
    Posts
    6
    Reputation
    0
    Tagged in
    2 Posts
    Add to this user's reputation
    This is really nice, however I have just a question regarding the download link.
    My realm has an apostrophe in its name, so when I put the download link, it just goes like that http://theunderminejournal.com/TheUndermineJournal.zip?key=blablabla&realms=EUA-Eldre'Thalas (the beginning is taken into account, but the end isn't) (the link won't work, I masked the key). I tried to change the apostrophes with quotations marks, and also to put it like this \' (like in vim) but neither works.
    Do you know how I could correct that ?

  4. #4
    You need to encoding the ' (just like space = %20)

    your correct url should be: http://theunderminejournal.com/TheUndermineJournal.zip?key=blablabla&realms=EUA-Eldre%27Thala

    and dont forget to change that key=blablabla to your own key

    hope it helps.

  5. #5
    Freohr's Avatar
    Posts
    6
    Reputation
    0
    Tagged in
    2 Posts
    Add to this user's reputation
    Thanks, it works perfectly now

  6. #6
    Aeriwen's Avatar
    Posts
    28
    Reputation
    16
    Tagged in
    11 Posts
    Add to this user's reputation
    If that doesn't work. Make sure that it is enclosed the link in double quotes and then you can use the escape character. Powershell's escape character is `. The back quote (by the "1" key).So, to pass the ' in your server's name, you need to add a ` before the '.

    "http://theunderminejournal.com/TheUndermineJournal.zip?key=blablabla&realms=EUA-Eldre`'Thalas"

    If TUJ can handle the api escape, then that makes it much easier.
    Last edited by Aeriwen; January 19th, 2012 at 08:31 AM.

  7. #7
    Got it set up and it works perfectly. Thanks a ton.

  8. #8
    You're so sexy for this. It worked great. Thanks for the write up.
    The only Goblin I know that is also a Dwarf.

  9. #9
    Blitzed's Avatar
    Posts
    39
    Reputation
    2
    Tagged in
    6 Posts
    Add to this user's reputation
    Thanks alot for this! very very much appreaciated
    ~ Blitzed
    -Reality is nothing... perception is everything-

  10. #10
    Any way to hide the popup command prompt or have the process occur in the background? It's not de-focusing my WoW window, but it's a little annoying having a command prompt pop out on top, then disappear after a second or so.

 

 

Similar Threads

  1. [ Addon/API] Suggestion for automatic data updates
    By Amandria in forum Official Forum of The Undermine Journal
    Replies: 2
    Last Post: February 24th, 2011, 09:55 AM
  2. The Undermine Journal Addon
    By Kathroman in forum Archive (Addons and Macros)
    Replies: 7
    Last Post: February 14th, 2011, 03:59 PM