IShellLinkDataList.py :  » Windows » pyExcelerator » pywin32-214 » com » win32comext » shell » demos » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Windows » pyExcelerator 
pyExcelerator » pywin32 214 » com » win32comext » shell » demos » IShellLinkDataList.py
from win32com.shell import shell,shellcon
import pythoncom, win32api, os, sys

temp_dir=win32api.GetTempPath()
linkname=win32api.GetTempFileName(temp_dir,'cmd')[0]
os.remove(linkname)
linkname+='.lnk'
print 'Link name:',linkname
ish=pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None,
  pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
ish.SetPath(os.environ['cOMSPEC'])
ish.SetWorkingDirectory(os.path.split(sys.executable)[0])
ish.SetDescription('shortcut made by python')

console_props={
  'Signature':shellcon.NT_CONSOLE_PROPS_SIG,
  'InsertMode':True,
  'FullScreen':False,    ## True looks like "DOS Mode" from win98!
  'FontFamily':54,
  'CursorSize':75,    ## pct of character size
  'ScreenBufferSize':(152, 256),
  'AutoPosition':False,
  'FontSize':(4, 5),
  'FaceName':u'',
  'HistoryBufferSize':32,
  'InputBufferSize':0,
  'QuickEdit':True,
  'Font':0,   ## 0 should always be present, use win32console.GetNumberOfConsoleFonts() to find how many available
  'FillAttribute':7,
  'PopupFillAttribute':245,
  'WindowSize':(128, 32),
  'WindowOrigin':(0, 0),
  'FontWeight':400,
  'HistoryNoDup':False,
  'NumberOfHistoryBuffers':32,
    ## ColorTable copied from a 'normal' console shortcut, with some obvious changes
    ## These do not appear to be documented.  From experimentation, [0] is background, [7] is foreground text
    'ColorTable':(255, 8388608, 32768, 8421376, 128, 8388736, 32896, 12582912,
        8421504, 16711680, 65280, 16776960, 255, 16711935, 65535, 16777215)
}

ishdl=ish.QueryInterface(shell.IID_IShellLinkDataList)
ishdl.AddDataBlock(console_props)
ipf=ish.QueryInterface(pythoncom.IID_IPersistFile)
ipf.Save(linkname,1)
os.startfile(linkname)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.