Click here to Skip to main content
15,887,998 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
it's my first question here on the website.
this is a GIF from my work
i'm work on active mobile numbers on telegram APP.

https://media.giphy.com/media/3ornkbjxXTVIGdfp4c/giphy.gif[^]

Like you can see in the GIF, i have to move the "tdata" folder and send it to a zip, then rename the zip file by the mobile number i'm working on.

i'm already have a .bat file that it works on move the "tdata" folder to the channels folder and sends it to the ZIP, and give it name "+20" then i rename it and paste the mobile number i have copied.

now i need a command to create the ZIP file with the mobile number i have copied

What I have tried:

this is my .bat file
mkdir C:\Users\elamy\Desktop\Telegram\Channels\tdata
rd "C:\Users\elamy\Desktop\Telegram\tupdates" /s /q
del "C:\Users\elamy\Desktop\Telegram\log.txt" /s /q
move "C:\Users\elamy\Desktop\Telegram\tdata" "C:\Users\elamy\Desktop\Telegram\Channels\tdata\tdata"
"C:\zipper.vbs" "C:\Users\elamy\Desktop\Telegram\Channels\tdata" "C:\Users\elamy\Desktop\Telegram\Channels\+20.zip"
rd "C:\Users\elamy\Desktop\Telegram\Channels\tdata" /s /q

and this is the .vbs zipper file 

Set Args = Wscript.Arguments
source = Args(0)
target = Args(1)

' make sure source folder has \ at end
If Right(source, 1) <> "\" Then
    source = source & "\"
End If

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set zip = objFSO.OpenTextFile(target, 2, vbtrue)
' this is the header to designate a file as a zip
zip.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
zip.Close
Set zip = nothing

wscript.sleep 500

Set objApp = CreateObject( "Shell.Application" )
intSkipped = 0

' Loop over items within folder and use CopyHere to put them into the zip folder
For Each objItem in objApp.NameSpace( source ).Items
    If objItem.IsFolder Then
        Set objFolder = objFSO.GetFolder( objItem.Path )
        ' if this folder is empty, then skip it as it can't compress empty folders
        If objFolder.Files.Count + objFolder.SubFolders.Count = 0 Then
            intSkipped = intSkipped + 1
        Else
            objApp.NameSpace( target ).CopyHere objItem
        End If
    Else
        objApp.NameSpace( target ).CopyHere objItem
    End If
Next

intSrcItems = objApp.NameSpace( source ).Items.Count
wscript.sleep 250

' delay until at least items at the top level are available
Do Until objApp.NameSpace( target ).Items.Count + intSkipped = intSrcItems
    wscript.sleep 200
Loop

'cleanup
Set objItem = nothing
Set objFolder = nothing
Set objApp = nothing
Set objFSO = nothing
Posted
Updated 7-Mar-16 8:13am
v5
Comments
Maciej Los 7-Mar-16 6:31am    
What you mean "current copied text"?
What have you tried?
Member 12374673 7-Mar-16 7:20am    
i'm working in create channels for telegram
so i copy each mobile number i use then rename or create a new folder by the mobile number i had copied,
so i'm searching in .bat to auto paste the mobile number i had copied to the folder name
Member 12374673 7-Mar-16 14:00pm    
i meant the clipboard
Maciej Los 7-Mar-16 14:14pm    
So... see my answer.
OriginalGriff 7-Mar-16 6:35am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
So show us the batch code you have at the moment!
Use the "Improve question" widget to edit your question and provide better information.

1 solution

You can't get the text directly from clipboard. You have to use some trick. Check this: How can I use Clipboard in vbscript? - Stack Overflow[^]

For further informaiton, please see:
A vb script function to get text data from the windows clipboard[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900