Jump to content

Problem with a return value


Recommended Posts

First off, my first post but I've gotten a lot of helpful information off of these forums before so thanks to everyone for that.

Now, I am reading some text to the clipboard from a software's help menu. This text includes the version number of the program, which is the value i'm parsing for.

The function is set up to check if the program is running, and if it isn't, start it. So, the problem I have is that if the program is already running when the function is called, it works flawlessly. If the function itself has to start the program, it always returns 0.

code below:

$bigLongString = ClipGet()
        
        $index = StringInStr($bigLongString, "<string>TheProgram, Version")
        
        $shorterString = StringTrimLeft($bigLongString, $index + 27)
        
        $build = StringSplit($shorterString, ",")
        
        MsgBox(0, "", $build[1])
        
        return $build[1]

its parsing an XML file and TheProgram is a placeholder for this post.

The msgbox dialog is for debugging. No matter if the program is running or not when the function is called, the msgbox always displays the correct string, but the return value is 0 in the circumstance i mentioned above.

Any help would be great. Thanks.

Link to comment
Share on other sites

First off, my first post but I've gotten a lot of helpful information off of these forums before so thanks to everyone for that.

Now, I am reading some text to the clipboard from a software's help menu. This text includes the version number of the program, which is the value i'm parsing for.

The function is set up to check if the program is running, and if it isn't, start it. So, the problem I have is that if the program is already running when the function is called, it works flawlessly. If the function itself has to start the program, it always returns 0.

code below:

$bigLongString = ClipGet()
        
        $index = StringInStr($bigLongString, "<string>TheProgram, Version")
        
        $shorterString = StringTrimLeft($bigLongString, $index + 27)
        
        $build = StringSplit($shorterString, ",")
        
        MsgBox(0, "", $build[1])
        
        return $build[1]
 oÝ÷ Ú+l¥ªìxs~)^jwSãë¢
Ú+¦Vz%uêߢ»aÊh²Ôázk n]©h+¢·^nè x
¢f­µêâ~Ø^¦º ­©¢²»§)ࢹè·^Ø^~éܶ*'ÇW¶¦²èÅ©pk+Êek+-ç(®·¶ËkxºÛaz·­º¹ïj[Í"Ø^r*ܺk-jwg§¶*'yÖ¢÷(^(ºW[z
ÞjÔájy,þ«¨µâ¢}ý¶ØbH·ö÷®×«²Ö§v+¢ºÞrÙrnëb·
+Çè®gºÚ"µÍÙÐÞ
K[YSYJ
JBÌÍÛ[YY[Ý[ÛH[YSYJ
BÙÐÞ
    ÌÍÛ[YY[Ý[ÛB[È[YSYJ
B   ÌÍØYÓÛÔÝ[ÈHÛÙ]

B   ÌÍÚ[^HÝ[Ò[Ý   ÌÍØYÓÛÔÝ[Ë  ][ÝÉÜÝ[ÉÝÕTÙÜ[KÚ[Û][ÝÊB    ÌÍÜÚÜÝ[ÈHÝ[Õ[SY
    ÌÍØYÓÛÔÝ[Ë  ÌÍÚ[^
ÈÊB   ÌÍØZ[HÝ[ÔÜ]
    ÌÍÜÚÜÝ[Ë ][ÝË  ][ÝÊBÙÐÞ
    ][ÝÉ][ÝË    ÌÍØZ[ÌWJB]  ÌÍØZ[ÌWB[[Â

My little company: Evotec (PL version: Evotec)

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...