Sign in to follow this  
Followers 0
bobheart

Script won't work in windows 98

5 posts in this topic

Does anyone know why ?

You can add one time to the ini file then each time it just over writes the first one and not add to it .

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)
Opt("TrayIconDebug",1)
GuiCreate("MyGUI", 438, 34,(@DesktopWidth-438)/2, (@DesktopHeight-34)/2, 0x04CF0000)

$combo_1 = GUISetControl("combo", "Combo 1", 10, 10, 260, 20)
$button_1 = GUISetControl("button", "Go", 280, 10, 70, 20)
$button_2 = GUISetControl("button", "Add", 360, 10, 60, 20)

$i = 1
$file = ""
$defaultvalue = ""

If FileExists("tray-app.ini") Then
   While 1
      $inivalue = IniRead("tray-app.ini","Application","App" & $i,"")
      If $inivalue = "" Then ExitLoop
      If $i = 1 Then $defaultvalue = $inivalue
      $file = $file & $inivalue & "|"
      $i = $i + 1
   WEnd
   GUISetControlData($combo_1,$file,$defaultvalue)
EndIf
$maxi = $i - 1

GuiShow()

While 1
   $msg = GuiMsg()
   Select
      Case $msg = -3
         Exit

      Case $msg = $combo_1
      ;;;

      Case $msg = $button_1
         If GUIRead($combo_1) <> "" Then    
            Run(GUIRead($combo_1))
         EndIf
            
      Case $msg = $button_2
         $message = "Hold down Ctrl or Shift to choose multiple files."
         $file = FileOpenDialog($message, "C:\", "Images (*.exe)", 1 + 4 )
         If @error = 0 Then
            If StringInStr($file,"|") > 0 Then; multiple files selected
            $splitfile = StringSplit($file,"|")
            For $i = 2 To $splitfile[0]; 2 = folder, 3 = file1, 4 = file2 ...
               $file = $splitfile[1] & "\" & $splitfile[$i]
               If FileCheck($file) = 0 Then; check if the entry is already in the list
                  GUISetControlData($combo_1, $file);add data to list
                  GuiWrite($combo_1, 0, $file)
                  $maxi = $maxi + 1
                  IniWrite("tray-app.ini","Application","App" & $maxi,$file)
               EndIf
            Next
         Else
            If FileCheck($file) = 0 Then; check if the entry is already in the list
               GUISetControlData($combo_1, $file);add data to list
               GuiWrite($combo_1, 0, $file)
               $maxi = $maxi + 1
               IniWrite("tray-app.ini","Application","App" & $maxi,$file)
            EndIf
         EndIf
      EndIf
    EndSelect
WEnd

Exit

Func FileCheck($file)
   Local $i, $file
   $i = 1
   $found = 0
   If FileExists("tray-app.ini") Then
      While 1
         $inivalue = IniRead("tray-app.ini","Application","App" & $i,"")
         If $inivalue <> "" Then ExitLoop
         If $inivalue = $file Then
            $found = 1
            ExitLoop
         EndIf
         $i = $i + 1
      WEnd
   EndIf
   Return $found
EndFunc

Share this post


Link to post
Share on other sites



Would it work if I used the registry and not a ini file ?

How would i used the reg to do this ?

Share this post


Link to post
Share on other sites

bump^^^^^^^^^^^^^^^^^^^

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Well in windows XP you can add a link to a exe . in windows 98 it will just over write the one you do so it never adds to the line just keeps over writng the first one.

Ever time you add a exe path it writes it to the file soi it shows all the paths to the exe and all you have to do is click on one and click go and it opens the exe but in 98 it never adds to the list . just over writes the first one .

Edited by bobheart

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
Sign in to follow this  
Followers 0