cavan.smith Posted March 3, 2023 Share Posted March 3, 2023 Hi there, can anyone help me change this script to import a image resource rather than a symbol into the resource browser? import os major, minor, maintenance, platform = vs.GetVersion() isMac = False if platform == 1: isMac = True # define a location to import the images importPt = (0,0) symCreatedCnt = 0 err, dirPath = vs.GetFolder( 'Select a Folder' ) if err == 0: # no-error hsfDirPath = dirPath if isMac: ok, hsfDirPath = vs.ConvertPosix2HSFPath( dirPath ) fileIndex = 1 while True: # loop the files fileName = vs.GetFilesInFolder( hsfDirPath, fileIndex ) fileIndex += 1 if fileName == '': # no more files break name, ext = os.path.splitext( fileName ) if ext.lower() == '.png' or ext.lower() == '.jpg': imagePath = os.path.join( dirPath, fileName ) vs.BeginSym( name ) hImage = vs.ImportImageFile( imagePath, importPt ) vs.EndSym() symCreatedCnt += 1 vs.AlrtDialog( 'Done! Created ', symCreatedCnt , ' symbols.' ) Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.