Jump to content

LosOjos

Members
  • Posts

    6,910
  • Joined

Everything posted by LosOjos

  1. Supposedly you're supposed to use ReleaseComObject to properly terminate some Office applications after calling Quit, but that doesn't seem to work for me either: [system.Runtime.InteropServices.Marshal]::ReleaseComObject($MSPPT) Source: Windows PowerShell Tip: Getting Rid of a COM Object (Once and For All)
  2. You may have already cracked it, but just in case, this does it: $MSPPT = New-Object -ComObject powerpoint.application $PRES = $MSPPT.presentations.open("C:\test.pptx", 2, $True, $False) foreach($Slide in $PRES.slides) { $Slide.Export("C:\" + $Slide.Name + ".jpg", "JPG") } $MSPPT.Quit() You were right RE the Open method being the same as I was using, didn't realise it'd accept bools (assumed it wouldn't because of earlier error!). The last argument is the one that sets whether it's shownor not, so change that to $True (or omit it entirely) if you want to see the presentation open Problem I'm having is that PowerPoint won't quit - according to the documentation, you don't/can't set an exit code, which would make your "no overload" error ring true, however if I check taskman PowerPoint continues running...
  3. Slides have an Export method which is simply Slide.Export(string filename, string filetype) E.G. Slide.Export("C:\slide.jpg", "JPG") You can get a collection fo slides from ActivePresentation.Slides or pick an individual one by specifying it's index (starting from 1) e.g. ActivePresentation.Slides(1) Just brain dumping - hope it helps!
  4. OK great, narrowing it down! If you change the second argument in the overloaded Open method I posted earlier to 'msoTrue', it'll open read-only - perhaps that'll be enough to overcome the problem?
  5. Bit of a long shot but have you tried it exactly as I posted it i.e. without the 'visible' line? Also, have you tried opening the file manually to check it's not corrupt?
  6. OK, I'll start by saying I know almost nothing about Powershell, however I do have some experience with Office scripting. I believe the problem you're having is that Powerpoint won't allow you to open a presentation while it's hidden. However, there's a workaround: you can open the presentation hidden with an overloaded Open() method, like so: $MSPPT = New-Object -ComObject powerpoint.application $MSPPT.presentations.open("C:\test.pptx",[Microsoft.Office.Core.MsoTriState]::msoFalse,[Microsoft.Office.Core.MsoTriState]::msoFalse,[Microsoft.Office.Core.MsoTriState]::msoFalse) All very backwards but that works (for me at least) and you'd never know Powerpoint was open. More info on that overloaded Open method: PPT97: How to Use the Presentations.Open Method EDIT: how do you do syntax highlighting on here BTW? Tried quoting your post to see it but it just had a load of 'color' tags - you didn't do it manually, did you?!
  7. @nephilim - did you get it working?
  8. I shall pass on that info (and bookmark this thread...) - though through brief chat on Twitter I believe he just wants to know how Lisp works Yeah I've always enjoyed programming in .Net for the simple reason that I can create a GUI in minutes and focus on my backend, rather than having to programatically create a GUI then tinker with nudging things a few pixels this way, a few that... but I hate having to have users install a specific version of .Net just to run my applications and all the added overhead using managed code adds. You can pretty much say the same for Java, although it being cross platform is a plus! I love the way Python handles lists and strings ('slices' need implementing in all languages!) and that it's cross platform, but I just can't imagine myself working on a major project with it. I don't know why, I haven't come across a situation whereby I've felt it's lacking anything I need (though I've never done anything more complicated than this with it), it just "feels" like a scripting language somehow... perhaps it's just that explicit typecasting snobbery I still harbour deep inside! I'm trying for about the fifth time to really do something with C++ at the moment as I still see that as kind of the "holy grail" of coding; suitable for just about any [non-web] purpose, on just about any device regardless of OS, kernel or even architecture, there will almost certainly be a compiler for it (so long as you avoid native methods of course...); it's the Swiss army knife of programming languages! Problem is, I always find myself getting frustrated with the GUI coding side and slob back over to .Net/Java... I looked in to VC++ with MFC, but then you're straight back to managed code and bulky prerequisites, which kind of feels like cheating to me. When all is said and done though, I think my biggest problem is I've never taken coding seriously enough; I can code well enough to find my way through most languages (though Lisp came as a shock I must say!) so I just kind of coast along picking up new skills when I need them.
  9. Like I say, I've no idea! I got the impression he thought you needed to use emacs to administer the SQLite DB, so he was learning some LISP to enable him to code some of the work out. If that's the case, he'll be chuffed to find he can do it all from Python (which he's better than I am with!). On the other hand, he's a bright lad and much like myself at his age, he likes a challenge, so he may have set himself the limitation of using LISP just so that he had a practical use to learn it from - as I say, can't knock that on a personal project (I'd seriously discourage it for an important/time limited project mind you!). I've been dragging myself in to the 21st century lately where coding is concerned and have been looking at things like jQuery, Python and Ruby. I may never have bothered if it weren't for the code club as I was quite happy with my "old fashioned" skills (PHP, .Net, Java etc.), but it quickly became apparent that those 3 were pretty much the be all and end all of coding to the youngsters and I'd never used any of them! I must say, once I got past the lack of explicit typing (messes with my "OCD" like you wouldn't believe) I found Python very enjoyable and why I didn't give jQuery a chance years ago I can't imagine!
  10. Thanks for this, will have a read later - one of the lads at the code club I help out at was looking in to SQlite for a Python project he started last week, but he had gone off down the path of Common LISP for maintaining the DB - I'm not sure whether this is because he believes it's the only way, whether he has been learning LISP anyway so just wanted to use it (a good enough reason for a personal project in my opinion) or he just likes a challenge! Either way, it's always handy to read up on these things. Didn't have a lot of time left to help him out with it in the end but said I would take a look once I had gotten my head around LISP. Working at a code club has certainly made me realise how limited my knowledge is!
  11. How are you trying to call the macro? Strictly speaking, a sub routine which takes arguments isn't a macro as it's not automatic - a true macro is simply a script that calls other VBA functions automatically, not requiring initialization of it's own*. If you're trying to run the macro from the "Macros" menu, then I suspect this is why you're not seeing it. You need to decide on how you are going to pass the MailItem object to your sub routine. If it's a case of you want the user to highlight a message in the viewing pane, click on the macro button and have it do it's thing, you could either rewrite the script to pick up the MailItem automatically, or write a "wrapper" macro that calls the sub routine passing it the MailItem it needs. To take my example of automatically getting the currently selected item in the view pane, you could use this macro: Sub ExtractAttachments() Dim i As Integer With Me.Application.ActiveExplorer.Selection If .Count > 0 Then For i = 1 To .Count If TypeOf .Item(i) Is Outlook.MailItem Then AttachmentPrint .Item(i) Next i End If End With End Sub Now, whether you want to do that in the sub routine itself or as a new macro is up to you, but the advantage of using a wrapper is that you can then create macros to be called from any kind of view that will do the job of finding the MailItem then pass it to your sub to do the leg work. * that's my understanding anyway, there may be more to it than that but it's a general rule that's always rang true for me!
  12. I use this tool for reading dmp files, can make tracking an issue down much easier: NirSoft Blue Screen View (NOTE: this is dependant on Windows 8 being setup to create minudump files when it BSODs, there's an MS Support article here telling you how to do that: How to configure system failure and recovery options in Windows)
  13. If all else fails, I can share my ID system with you - it's just an Access DB which downloads student photos and details from SIMS using CLR, then you set up your print template on a form, set the print size and done. I'm sure it could be adapted for staff fairly easily.
  14. I believe you can put a size (in pixels) directly inside the tag in the template, e.g.
  15. No problem, glad you found a solution that works for you
  16. This is one of those SIMS problems that make me want to scream; it's such a simple thing to do in SQL that I'm frankly amazed there isn't a predefined report for it. Moaning aside, there are ways to get what you want, but it's not exactly simple. What you need to do is design a Student report with all the student details you'll need in it (I tend to put in every type of useful data I can think of to save me having to redesign the report when someone says "it'd be great if their ethnicity was on there too!"). Then, add an "Attendance marks" sub report. You can then filter this sub report on a date range, allowing you to pick out just the half term you want. You can add as much/little detail as you like here, but at a minimum you'll want "Statistical meaning". While you're at it, use the subreport filters to exclude "Attendance not required" marks (it'll make your calculations easier in Excel if these are excluded). Once you get that data in to Excel, you can use a Pivot Table on "Statistical Meaning", set the display type to "percent of row" and then you'll have the percent attendance for the given date range. There are a few ways you can go from there; either run the report for each term, then use Vlookups from a final sheet to pull the termly attendance for each student in to a new report. This is the easiest, but involves the most work each time it needs to be done. The way I'd do it would be to write some macros to manipulate the data for me, and pull all the marks out on the report (i.e. the year to date). Then you have your macro create a list of students from their admission #/UPN/ID (I always recommend ID, as guest students get no admission number and UPNs can change or may be missing, whereas the Person_ID is consistently available and unchanging). Then it's case of populating columns with count/countifs to calculate the percentage attendance for each term based on data range. It'll take a little while to set up and the final report will probably only be manageable when run a year group at a time, but it will be easiest in the long run for whoever has to use it. I have a couple of reports similar to the macro one I mentioned that I could manipulate for you to deal with attendance if you like?
  17. It's a function, running it as a Sub won't return anything. You need to create a module in your workbook's VBA project, then paste the code in to that module. Then you use it just as you would any other Excel function, i.e. type in a cell (assuming cell A1 contains a post code): =OSGetDistrict(A1) I've attached an example for you (in Excel 97 format because that works for everyone!) EDIT: I should point out that you'll have to bear in mind this macro looks up each postcode individually from the OS DB, so be prepared to wait for it if you are looking up a lot of them! Also worth mentioning if you plan to use this in a report you wish to save, copy/paste as values the postcodes when they've been looked up, otherwise every time Excel tries to recalculate formulas (every time you edit a cell by default), it'll redo each lookup, which can get very annoying! PS: Randomly generating data may be one of my favourite time wasters... time to get out more! OSGetDistrict_Example.xls
  18. What exactly is the problem? Are you getting any errors? No results? Where are you using it? Come on @nephilim give us a decent error report man!
  19. I have an Add-In full of macros for Excel that have been developed over the years. As @Seb1780 said though, Office has come on a long way so that I probably ought to purge them really. Here are two that are very useful in conjunction and can be used the same way as any standard Excel formula in a spreadsheet. Pretty self explanartory what they do, I find them very helpful in summarising RAG coloured marksheets coming out of SIMS: Public Function cell_colour(Cell_Check As Range) As Long cell_colour = Cell_Check.Interior.Color End Function Public Function count_colour(Count_Range As Range, Colour As Long) As Long Dim x As Range count_colour = 0 For Each x In Count_Range If x.Interior.Color = Colour Then count_colour = count_colour + 1 End If Next x End Function Then there's my "Special Lookup" - similar VLookup, but you can set the row and column offset to return from the found result (which can be anywhere in the specified range), and specify a custom value to return if no match is found. You can achieve the same with Index and Match but it gets complicated very quickly. Public Function SPECIAL_LOOKUP(lookup_value As String, lookup_range As Range, Optional column_offset As Long = 0, Optional row_offset As Long = 0, Optional on_error As Variant = "NOT FOUND") As Variant On Error Resume Next Dim x As Variant For Each x In lookup_range If x.Value = lookup_value Then SPECIAL_LOOKUP = x.Offset(row_offset, column_offset).Value Exit Function End If Next x SPECIAL_LOOKUP = on_error End Function Next in my list of useful Excel macros is "Clone Footer". I made this because, irritatingly, highlighting all sheets to try to change the footer for them all not only changes the footer, but all the page setup options. I discovered this the hard way when trying to change the footer on a 20+ sheet workbook with a mixture of landscape/portrait pages . This one needs to be called from the editor or, as I have done, a custom menu option. Open the sheet containing the footer you want cloning to the other sheets, run it and job done: Public Sub CloneFooter() If ActiveWorkbook.Windows(1).SelectedSheets.Count > 1 Then MsgBox "Please select only the sheet containing the footer you'd like to clone to all other sheets in the workbook", vbOKOnly + vbExclamation, "Error" Exit Sub End If lFooter = ActiveWorkbook.ActiveSheet.PageSetup.LeftFooter cFooter = ActiveWorkbook.ActiveSheet.PageSetup.CenterFooter rFooter = ActiveWorkbook.ActiveSheet.PageSetup.RightFooter For Each s In ActiveWorkbook.Sheets s.PageSetup.LeftFooter = lFooter s.PageSetup.CenterFooter = cFooter s.PageSetup.RightFooter = rFooter Next s End Sub Finally (for now!) here's one that will take a given post code and look it up on the Ordnance Survey database, returning the authority responsible. Created this as our SEN department needed a reliable way to identify which authorities to bill for their SEN students (incidentally, this one is attached to a SIMS report to do this all automatically, if anyone wants that report PM me). This is used like any other Excel formula: Public Function OSGetDistrict(PostCode As String) As String Dim rows() As String Dim cols() As String Dim oHttp As Object Set oHttp = CreateObject("Microsoft.XMLHTTP") myURL = "http://data.ordnancesurvey.co.uk/datasets/os-linked-data/apis/sparql?query=PREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+postcode%3A+%3Chttp%3A%2F%2Fdata.ordnancesurvey.co.uk%2Fontology%2Fpostcode%2F%3E%0D%0A%0D%0ASELECT+DISTINCT+%3Fdistrict+%3Fname%0D%0AWHERE+%7B%0D%0A%0D%0A%3Fpostcode+rdfs%3Alabel+%22" + Replace(PostCode, " ", "+") + "%22+%3B%0D%0A+postcode%3Adistrict+%3Fdistrict+.%0D%0A%3Fdistrict+rdfs%3Alabel+%3Fname++.%0D%0A%7D&output=csv" oHttp.Open "GET", myURL, False oHttp.send If oHttp.Status < 300 Then rows = Split(oHttp.responseText, vbNewLine) cols = Split(rows(1), ",") If UBound(cols) < 1 Then OSGetDistrict = "Postcode Not Recognised" Else OSGetDistrict = cols(1) End If Else OSGetDistrict = "Server Error: " + oHttp.Status End If End Function
  20. I've used this in the past (at least I think it was this, it looks familiar but it was quite some time back): https://www.rescuetime.com/ Be very careful doing this though, in fact don't do it until you've spoken to SLT. You are tracking usage and some might have a problem with that, they may even go far as to say you're spying on them... could be a nightmare for the school if unions get involved! Don't do this without SLT's backing!
  21. Not sure if this is what you're asking, but the one reason you should definitely make them leave in advance via the leavers routine is that this will automatically update their learning aims, saving you a hell of a lot of time when it comes to Autumn census! If you wait until afterwards, you'll have to manually update the learning aims end dates, which can take hours, as I'm sure you know!
  22. RE my comparison of Mac OS and *nix roots - that's what I get for not fact checking before I post! Sorry for the misinformation.
  23. Sorry for the frosty reception - we've had a lot of spammers around lately so first/second posts with links ring alarm bells! to EduGeek - we're friendly really
  24. It's not a scam, as has been established... EDIT: sorry if that sounded harsh, always suspicious of folk who sign up and post random responses and links... your response wasn't totally random but you obviously haven't read the thread. Apologies if you were trying to help!
  25. I wouldn't put anything important on there; it's Kim Dotcom's latest venture and I can't see the US stopping until they have destroyed him...
×
×
  • Create New...