Jump to content

Inconsistent String Variable


namauto
 Share

Recommended Posts

So I'm trying to take a file name from an array, and open the file in a program. Sometimes it works, sometimes it doesn't, with no changes to the code. I made a MsgBox so that I could make sure the file name was right in the array (and it is, consistently), but then when I try to use it to open the file, it says the file doesn't exist, and there are a few characters missing from the file name. Its different characters at different times. I have no idea what's going on, this worked earlier for me, but now it doesn't, and I have made no real changes.

Please help.

Dim $fileNum
Dim $fileList
$fileList = _FileListToArray("...\SC", "*", 1)
$fileNum = $fileList[0]
Run("...\Charles.exe", "...\Charles\")
WinWait("Charles 3.2.1 - Session 1 *")

$fileName = $fileList[3]
Call ("charlesExport", $fileName)

Func charlesExport($fileName)
    $fileNoExt = StringSplit($fileName, ".")
    $charlesName = "Charles 3.2.1 - "&$fileNoExt[1]
    MsgBox("", "", $fileName)
    Send("^o")
    Send($fileName)
    Send("{ENTER}")
EndFunc
Link to comment
Share on other sites

So I'm trying to take a file name from an array, and open the file in a program. Sometimes it works, sometimes it doesn't, with no changes to the code. I made a MsgBox so that I could make sure the file name was right in the array (and it is, consistently), but then when I try to use it to open the file, it says the file doesn't exist, and there are a few characters missing from the file name. Its different characters at different times. I have no idea what's going on, this worked earlier for me, but now it doesn't, and I have made no real changes.

Please help.

Dim $fileNum
Dim $fileList
$fileList = _FileListToArray("...\SC", "*", 1)
$fileNum = $fileList[0]
Run("...\Charles.exe", "...\Charles\")
WinWait("Charles 3.2.1 - Session 1 *")

$fileName = $fileList[3]
Call ("charlesExport", $fileName)

Func charlesExport($fileName)
    $fileNoExt = StringSplit($fileName, ".")
    $charlesName = "Charles 3.2.1 - "&$fileNoExt[1]
    MsgBox("", "", $fileName)
    Send("^o")
    Send($fileName)
    Send("{ENTER}")
EndFunc
Use the "raw flag" for Send($fileName, 1) if there is punctuation in the file name, like "+" that would be interpreted as a metakey like "shift".

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...