Windows Mobile automatically packs scripts and supports Chinese shortcuts

Source: Internet
Author: User

The principle is to use setup. dll. I just automated the command line. Sometimes it is very troublesome to pack a few times.

Usage:
1. Download the attachment and decompress it to any directory.
2. Put all the resource files and exe files you want to install in this directory, modify make. py, and change Provider and AppName to your own. Here, the Chinese AppName cannot be used as the directory.
3. If you want to change the program shortcut name, change chinaname in config/config.txt.
4. Run make. py on the command line to view the successful compilation information.

The script code is as follows:

# Coding = utf-8import osimport OS. pathworkpath = OS. path. dirname (_ file __) provider = "talkweb" # The company name cannot be Chinese AppName = "test" # the program name cannot be Chinese SourceDisksNames = "" CopyFiles = "" SourceDisksFiles = "" DestinationDirs = "" Body =" "# cab tool directory, mobile sdk5, 6 cab_tools = '"D: \ Program Files \ Microsoft Visual Studio 9.0 \ smartdevices \ sdk \ sdktools \ cabwiz.exe" 'f = open ("template. inf ") inf_content = f. read () f. close () nIndex = 1 For root, dirs, files in OS. walk (workpath): for name in files: if not name. endswith (". inf ") and not name. endswith (". CAB ") and not name. endswith (". py "): #1 =," Common1 "," C: \ workspace \ WindowsMobile \ InstallCab \ "SourceDisksNames + = str (nIndex) + '=, \ "Common '+ str (nIndex) + '",, "'+ root +' \" '+ "\ n" SourceDisksFiles + =' "'+ name +'" '+ "=" + str (nIndex) + "\ n" # Files. common1 = 0, "% InstallDir % \ config" Destin AtionDirs + = "Files. common "+ str (nIndex) + '= 0," % InstallDir %' if len (root [len (workpath):])> 0: destinationDirs + = root [len (workpath):] DestinationDirs + = '"' +" \ n "# [Files. common74] # "SetupDLL. dll "," SetupDLL. dll ", 0 Body + =" [Files. common "+ str (nIndex) +"] \ n "Body + = ('" % s "," % s ", 0') % (name, name) body + = "\ n" nIndex + = 1for x in xrange (nIndex): if x> 0: CopyFiles + = "Files. common "+ str (x) if x! = (NIndex-1): CopyFiles + = "," if _ name _ = "_ main _": inf_content = inf_content.replace ("{Provider}", Provider) inf_content = inline ("{AppName}", AppName) inf_content = inf_content.replace ("{SourceDisksNames}", SourceDisksNames) inf_content = inf_content.replace ("{CopyFiles}", CopyFiles) inf_content = encrypt ("{SourceDisksFiles}", SourceDisksFiles) inf_content = inf_content.replace ("{DestinationDirs}", DestinationDirs) inf_content = inf_content.replace ("{Body}", Body) open (AppName + ". inf "," w "). write (inf_content) cmd = cab_tools + "" + AppName + ". inf/err CabWiz. log "OS. system (cmd)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.