我使用以下vbs来读取目录中的JPG图像:
Globals:
Function:
Runtime: nodejs6.10
Environment:
Variables:
API: !Sub https://${Api}.execute-api.${AWS::Region}.amazonaws.com/prod
Resources:
Entry:
Type: AWS::Serverless::Function
Properties:
FunctionName: prompt-stack-Entry
Handler: LeadLambda.entry
CodeUri: s3://ddg-prompt/LeadLambda.zip
Role: !GetAtt LeadRole.Arn
Events:
GetResource:
Type: Api
Properties:
Path: /lead
Method: POST
RestApiId: !Ref Api
Api:
Type: AWS::Serverless::Api
Properties:
StageName: prod
DefinitionBody:
swagger: 2.0
info:
title:
Ref: AWS::StackName
paths:
/lead:
post:
responses:
'200':
description: Successful operation
responseTemplates:
application/json: ""
x-amazon-apigateway-integration:
httpMethod: POST
type: aws
uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:prompt-stack-Entry/invocations
responses:
default:
statusCode: '200'
responseTemplates:
application/json: ''
例如目录内容:
Set objFolder = objFso.GetFolder(objShell.CurrentDirectory)
Set TifCollection = CreateObject("Scripting.Dictionary")
For Each objFile In objFolder.Files
If objFso.GetExtensionName (objFile.Path) = "jpg" Then
file = Split(objFile.Name, "_")(0)
page = Split(objFile.Name, "_")(1)
If Not TifCollection.Exists(file) Then
TifCollection.Add file, CreateObject("Scripting.Dictionary")
End If
TifCollection.Item(file).Add page, ""
End If
Next
现在的问题是我创建的数组image-00003844_1.jpg
image-00003844_2.jpg
image-00003844_3.jpg
...
image-00003844_10.jpg
按如下方式排序:
TifCollection
换句话说,图像image-00003844_1.jpg
image-00003844_10.jpg
image-00003844_2.jpg
image-00003844_3.jpg
...
image-00003844_9.jpg
跟在图像10
之后,因为我假设数组是按字母顺序排序的(?)
当我稍后循环遍历数组时,我需要正确的数字顺序:
1
如何重新排序数组?
---- image-00003844_1.jpg
image-00003844_2.jpg
...
image-00003844_10.jpg
-----
EDIT - FULL CODE