+ Post New Thread
Results 1 to 3 of 3
Windows Vista Thread, BAT File issue in Technical; Hey, I am a photographer and am trying to make a .bat file to open photos when I take a ...
  1. #1

    Join Date
    Sep 2008
    Location
    Oakham
    Posts
    31
    Thank Post
    14
    Thanked 1 Time in 1 Post
    Rep Power
    0

    BAT File issue

    Hey,

    I am a photographer and am trying to make a .bat file to open photos when I take a photo onto my PC, I have canon software that will get it off my camera via the data lead but now I need to make a bat file to open it in windows gallery then 10 seconds later close it! But I cant get it to work!

    Here is that I have the first line works and opens the image, its the sleep for 10 seconds and the closing of windows gallery...

    Code:
    C:\WINDOWS\system32\rundll32.exe C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen %~1
    
    sleep 10
    
    TASKKILL /F /IM "rundll32.exe"

    Any ideas?

    Dan

  2. #2

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Would be easier using AutoIT.....
    Specially the Taskkill. Process close would be a better choice !!

    Checkout AutoIt Script Home Page

  3. #3

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,729
    Thank Post
    3,252
    Thanked 1,049 Times in 971 Posts
    Rep Power
    364
    Vbscript version below :

    Code:
    Dim oShell
    Dim intSleep
    
    intSleep = 10 * 1000
    
    Set oShell = WScript.CreateObject ("WSCript.shell")
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    
    oShell.run "rundll32.exe %SystemRoot%\system32\shimgvw.dll,ImageView_Fullscreen"
    
    wscript.sleep intSleep
    
    Dim objWMIService, objProcess, colProcess
    Dim strComputer, strProcessKill
    strComputer = WshNetwork.ComputerName
    strProcessKill = "'rundll32.exe'"
    
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
    
    Set colProcess = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = " & strProcessKill )
    For Each objProcess in colProcess
    objProcess.Terminate()
    Next
    WSCript.Echo "Just killed process " & strProcessKill _
    & " on " & strComputer
    WScript.Quit 
    oShell = Nothing
    First attempt so appologies if it does not work or if there are some coding ommisions.

    You can get rid of the messagebox at the end of you wish just delete the 2 lines in bold in the coded example.

    You can download the text version below and rename the file extension from txt to vbs and run it
    Attached Files Attached Files
    Last edited by mac_shinobi; 14th March 2009 at 02:19 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. SIMSPERM.bat
    By cookie_monster in forum MIS Systems
    Replies: 13
    Last Post: 14th May 2014, 02:02 PM
  2. The Bat
    By Dos_Box in forum General Chat
    Replies: 1
    Last Post: 11th July 2008, 01:19 PM
  3. Stopping SQL using a Bat file
    By ful56_uk in forum Windows
    Replies: 4
    Last Post: 7th April 2008, 12:09 AM
  4. simsperm.bat
    By robert.mabbutt in forum MIS Systems
    Replies: 9
    Last Post: 15th August 2007, 09:43 PM
  5. WS Security or simsperm.bat
    By techyphil in forum MIS Systems
    Replies: 9
    Last Post: 16th March 2007, 12:56 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •