Wolfshare

File name with random strings.

28 posts in this topic

Hello, i have a little problem with my script, i am using this kind of line, to check if the file is exist, and if it is on C:\Users\Tomas\Downloads folder then winrar them to C:\Users\Tomas\Downloads\Test\

 

if $FileToRun1 = "Get it.zip" Then

Run(@ProgramFilesDir & '\winrar\winrar.exe x "C:\Users\Tomas\Downloads\Get it.zip" "C:\Users\Tomas\Downloads\Test\"')

 

But the problem that that file after downloading them comes with random strings like Get it__3687_i1566636907_il91240.exe.zip

 

And i have no idea how to make script detect this file with random strings and then extract it..

 

Share this post


Link to post
Share on other sites



In the helpfile, look at the _FileListToArray and FileFindFirstFile/FileFindNextFile functions

Please, help me with it...

Share this post


Link to post
Share on other sites

What do you need help with, and what did you try on your own already?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Erm...with 195+ posts one would expect you to know how to look in the help file. As for your problem, doesn't really make much sense to me.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

What do you need help with, and what did you try on your own already?

Actually, i have no idae how to make it match the file..

 

Tried reading help files, trust me.. I am not Lazy, but i am simply do not understand this part.. Everything in my script works good, but not the part with finding file name, which has random generated numbers every time..

 

 

Share this post


Link to post
Share on other sites

I think you want to detect a path with that feactures (random numbers some characters and special characters). Am I right?

 

Saludos

Share this post


Link to post
Share on other sites

Not a lot of info to go on, so I'm not sure if this would help you at all or not, but try replacing your IF statement with this...

If StringLeft($FileToRun1,6) = "Get it" and StringRight($FileToRun1,4) = ".zip"

 

Share this post


Link to post
Share on other sites

I think you want to detect a path with that feactures (random numbers some characters and special characters). Am I right?

 

Saludos

That's right!

Share this post


Link to post
Share on other sites

Simple use file list to array.

Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\")
Local $sFileINeed = ""
For $i = 1 To $aArray[0]
    If StringInStr($aArray[$i], "Get it") And StringInStr($aArray[$i], ".exe.zip") Then
        $sFileINeed = $aArray[$i]
        ExitLoop
    EndIf

Next

Saludos

Share this post


Link to post
Share on other sites

Simple use file list to array.

Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\")
Local $sFileINeed = ""
For $i = 1 To $aArray[0]
    If StringInStr($aArray[$i], "Get it") And StringInStr($aArray[$i], ".exe.zip") Then
        $sFileINeed = $aArray[$i]
        ExitLoop
    EndIf

Next

Saludos

Oke, but how to make them to extract that file to this folder?

Downloads\Test

Used this line before.. But how to to do it right now? :x

 

Run(@ProgramFilesDir & '\winrar\winrar.exe x "C:\Users\Tomas\Downloads\Get Downloader.zip" "C:\Users\Tomas\Downloads\Test\"')

Share this post


Link to post
Share on other sites

Simple use file list to array.

Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\")
Local $sFileINeed = ""
For $i = 1 To $aArray[0]
    If StringInStr($aArray[$i], "Get it") And StringInStr($aArray[$i], ".exe.zip") Then
        $sFileINeed = $aArray[$i]
        ExitLoop
    EndIf

Next

Saludos

Oke, but how to make them to extract that file to this folder?

Downloads\Test

Used this line before.. But how to to do it right now? :x

 

Run(@ProgramFilesDir & '\winrar\winrar.exe x "C:\Users\Tomas\Downloads\Get Downloader.zip" "C:\Users\Tomas\Downloads\Test\"')

Share this post


Link to post
Share on other sites

append the paths. that I think. (I've never  used winrar with commandline)

Saludos

Share this post


Link to post
Share on other sites

Tried Danyfirex  solution, but still waiting for any help :(*

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

If all you need is this:

Run(@ProgramFilesDir & '\winrar\winrar.exe x ' & $sFileINeed & ' "C:\Users\Tomas\Downloads\Test\"')

You have to change your title.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Part of my code..

 

Local $tempPID = Run(@ComSpec & ' /C dir /b | findstr /M /R /C:"^Get.*zip$"', "C:\Users\Tomas\Downloads\", @SW_HIDE, $STDOUT_CHILD)
ProcessWaitClose($tempPID)
$FileToRun1 = StdoutRead($tempPID)
$FileToRun = '"' & 'C:\Users\Tomas\Downloads\' & $FileToRun1 & '"'
$FileToRun = StringRegExpReplace($FileToRun, "\r\n", "")
$FileToRun1 = StringReplace ($FileToRun1, @CRLF, "")


Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\")
Local $sFileINeed = ""
For $i = 1 To $aArray[0]
    If StringInStr($aArray[$i], "Get Downloader") And StringInStr($aArray[$i], ".exe.zip") Then
        $sFileINeed = $aArray[$i]

Run(@ProgramFilesDir & '\winrar\winrar.exe x ' & $sFileINeed & ' "C:\Users\Tomas\Downloads\Test\"')
Sleep(5000)

Still does not work :x

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

The path, the path...

For $i = 1 To $aArray[0]
    If StringInStr($aArray[$i], "Get Downloader") And StringInStr($aArray[$i], ".exe.zip") Then
        $sFileINeed = $aArray[$i]
        ExitLoop
    EndIf
Next
$sFileINeed = "C:\Users\Tomas\Downloads\" & $sFileINeed
Run(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"')

Edit
Or use

Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\", "*.exe.zip", 1, 1)
Local $sFileINeed = ""
For $i = 1 To $aArray[0]
    If StringInStr($aArray[$i], "Get Downloader") Then
        $sFileINeed = $aArray[$i]
        ExitLoop
    EndIf
Next
Run(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"')

 

Edited by mikell

Share this post


Link to post
Share on other sites

The path, the path...

For $i = 1 To $aArray[0]
    If StringInStr($aArray[$i], "Get Downloader") And StringInStr($aArray[$i], ".exe.zip") Then
        $sFileINeed = $aArray[$i]
        ExitLoop
    EndIf
Next
$sFileINeed = "C:\Users\Tomas\Downloads\" & $sFileINeed
Run(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"')

Edit
Or use

Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\", "*.exe.zip", 1, 1)
Local $sFileINeed = ""
For $i = 1 To $aArray[0]
    If StringInStr($aArray[$i], "Get Downloader") Then
        $sFileINeed = $aArray[$i]
        ExitLoop
    EndIf
Next
Run(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"')

 

Variable used without being declared.:
For $i = 1 To $aArray[0]
For $i = 1 To ^ ERROR

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now