Jump to content

OnTheFly

Active Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by OnTheFly

  1. Hi, I need some help to open the tray meny with the keyboard. (HotKeySet). How can i do it?
  2. Hi, i have this code: #Include "VelkyPortable\Data\Backup\_ZipPlugin.au3" $handle = PluginOpen(@ScriptDir & "\VelkyPortable\Data\Backup\Au3Zip.dll") $hFile = _ZipCreate(@ScriptDir & "\VelkyPortable\Backups\" & $app & "_" & @YEAR & "-" & @MON & "-" & @MDAY & ".zip") $v_ret = _ZipAddDir($hFile,@ScriptDir & "\VelkyPortable\Portable Apps\" & $cat & "\" & $app ,0) $v_ret = _ZipClose($hFile) PluginClose($handle) It keeps giving me a 22byte large Zip file. (Which don't work) Why?
  3. Heh, i solved it. And i have no idea how I changed a line to $value = IniRead("VelkyPortable/data/icons.ini", "categories", $categories[$i], "Not Found"), and fixed the if after.
  4. _FileListToArray() returns an array containing all folders in the dir. $categories[0] contains the ammount of folders.
  5. In VelkyPortable/apps/ i have "Internet", "File Management". It creates the tray menu fine, so the array is fine.
  6. Okay AutoIt code: #NoTrayIcon ;Include the File UDF's #Include <File.au3> ;Include the GUI constants #include <GUIConstants.au3> ;Include the file for the cool menu;) #include "ModernMenu.au3" ;Include the appinfo generator #Include "appinfogen.au3" ;Include the settings manager ;#Include "settings.au3" If Not IsDeclared("GW_OWNER") Then Global Const $GW_OWNER = 4 If Not IsDeclared("GWL_EXSTYLE") Then Global Const $GWL_EXSTYLE = -20 If Not IsDeclared("WM_GETICON") Then Global Const $WM_GETICON = 0x007F If Not IsDeclared("GCL_HICONSM") Then Global Const $GCL_HICONSM = -34 If Not IsDeclared("GCL_HICON") Then Global Const $GCL_HICON = -14 If Not IsDeclared("PROCESS_QUERY_INFORMATION") Then Global Const $PROCESS_QUERY_INFORMATION = 0x0400 If Not IsDeclared("PROCESS_VM_READ") Then Global Const $PROCESS_VM_READ = 0x0010 Dim $arTrayWin[500][3]; TrayIconID, WinTitle, WinHandle $arTrayWin[0][0] = 0 $nTrayIcon1 = _TrayIconCreate("Win2Tray", "shell32.dll", 230) ;Make an array containing mouse click values Dim $clicklist[13] $clicklist[0] = 8 $clicklist[1] = 16 $clicklist[2] = 24 $clicklist[3] = 1 $clicklist[4] = 2 $clicklist[5] = 3 $clicklist[6] = 9 $clicklist[7] = 18 $clicklist[8] = 4 $clicklist[9] = 32 $clicklist[10] = 36 $clicklist[11] = 27 $clicklist[12] = 64 ;Check if it has a valid value $click = Int(IniRead("VelkyPortable/data/settings.ini", "controls", "click", 0)) If $click > 11 Or $click < 0 Or $click = 0 Then MsgBox(48, "Warning!", "The key 'click' in settings.ini does not have a valid value. Using default 'ALL'") $click = $clicklist[12] Else $click = $clicklist[$click] EndIf _TrayIconSetClick(-1, $click) _TrayIconSetState(); Show the tray icon _TrayIconSetToolTip($nTrayIcon1, _GetTitle()) ;Add a "title" $title = _TrayCreateItem(-1, _GetTitle()) _TrayItemSetIcon(-1, "shell32.dll", 230) _TrayCreateItem(-1, "") ;$settingsmenu = _TrayCreateItem(-1, "Settings") ;_TrayItemSetIcon(-1, "shell32.dll", 274) $apppinfogen = _TrayCreateItem(-1, "appinfo.ini generator") _TrayItemSetIcon(-1, "shell32.dll", 151) $browsedrive = _TrayCreateItem(-1, "Browse the Drive") _TrayItemSetIcon(-1, "shell32.dll", 5) _TrayCreateItem(-1, "") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Dim an array for the categories in the traymenu Dim $traycategories[64] ;Dim an array for tray apps Dim $traycat[256] Dim $trayapp[256][256] Dim $traynr[256][256] ;Read all categories into an array $categories = _FileListToArray("VelkyPortable/apps/", "*", 2) ;Read the apps For $i = 1 To UBound($categories)-1 ;Add the category to the menu $traycategories[$categories[$i]] = _TrayCreateMenu(-1, $categories[$i]) ;Now we want an icon :D ;Read the value from the ini file $value = IniRead("VelkyPortable/data/icons.ini", "categories", $categories[$i], "") ;Split the value $icon = StringSplit($value, ",") If $icon[0] > 1 Then ;Remove spaces from the number $icon[2] = StringReplace($icon[2], " ", "") _TrayItemSetIcon(-1, $icon[1], Int($icon[2])) ElseIf $icon[0] = 1 Then _TrayItemSetIcon(-1, $icon[1]) EndIf $apps = _FileListToArray("VelkyPortable/apps/" & $categories[$i], "*", 2) ;Put them in the tray array For $x = 1 To UBound($apps)-1 $traynr[$i][$x] = _TrayCreateItem(-1, $apps[$x], $traycategories[$categories[$i]]) $trayapp[$i][$x] = $apps[$x] _TrayItemSetIcon(-1, "VelkyPortable/apps/" & $categories[$i] & "/" & $trayapp[$i][$x] & "/" & IniRead("VelkyPortable/apps/" & $categories[$i] & "/" & $trayapp[$i][$x] & "/appinfo.ini", "appinfo", "appexe", "../../../data/setup.ico")) Next Next ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; _TrayCreateItem(-1, "") $TrayExit = _TrayCreateItem(-1, "Exit") _TrayItemSetIcon(-1, "shell32.dll", -28) ;Show a baloon tip that VelkyPortable is started If IniRead("VelkyPortable/data/settings.ini", "tray", "startbaloon", "true") = "true" Then _TrayTip($nTrayIcon1, _GetTitle(), "VelkyPortable has started and are ready to launch your portable apps!", 3, 1) EndIf While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $TrayExit ExitLoop Case $title MsgBox(64, "About VelkyPortable", "VelkyPortable is a portable apps system. It contains a nice and simple tray menu interface to control your apps. You can simply add any portable app of your choise. Just create a new folder and put the files there. You can use the appinfo.ini generator to create the infofile." & @CRLF & @CRLF & "VelkyPortable is developed by Emanuel Claesson (a.k.a VelcroMan) in AutoIt3." & @CRLF & @CRLF & "You are currently using VelkyPortable " & IniRead("VelkyPortable/data/data.ini", "versioninfo", "version", "") & " on your " & _GetDriveSize() & " drive." & " (" & StringLeft(@ScriptDir, 3) & ")" & @CRLF & @CRLF & "Web: http://www.emanuel-claesson.se" & @CRLF & "Mail: emanuel.claesson@gmail.com") Case $apppinfogen appinfogen() Case $browsedrive Run("explorer " & _GetDriveLetter()) EndSwitch ;;;;;;;;;;;;;;; For $i = 1 To UBound($categories)-1 For $x = 1 To Ubound($traynr)-1 If $traynr[$i][$x] = "" Then ExitLoop If $msg = $traynr[$i][$x] Then Run("VelkyPortable/apps/" & $categories[$i] & "/" & $trayapp[$i][$x] & "/" & IniRead("VelkyPortable/apps/" & $categories[$i] & "/" & $trayapp[$i][$x] & "/appinfo.ini", "appinfo", "appexe", "__NotFound__")) EndIf Next Next ;;;;;;;;;;;;;;;; WEnd _TrayIconDelete($nTrayIcon1) Func _GetDriveSize() $mb = Round(DriveSpaceTotal(StringLeft(@ScriptDir, 3)), 0) If $mb > 1024 Then return String(Round($mb/1024, 0) & "GB") Else return String($mb & "MB") EndIf EndFunc Func _GetDriveLetter() Return StringLeft(@ScriptDir, 3) EndFunc Func _GetTitle() $titlestr = IniRead("VelkyPortable/data/settings.ini", "general", "title", "VelkyPortable %version%") $titlestr = StringReplace($titlestr, "%version%", IniRead("VelkyPortable/data/data.ini", "versioninfo", "version", "")) $titlestr = StringReplace($titlestr, "%driveletter%", _GetDriveLetter()) Return $titlestr EndFunc And the ini file: #VelkyPortable icon list #Category name = icon.ico (Full path from VelkyPortable.exe) # or #Category name = dll, iconnumber # or #Category name = exe # # #If usedefault is set to true, a folder icon will be used if no icon is declared in this ini file. If false, no icon will be used. #usedefault = true # [categories] Internet = shell32.dll, 14 File Management = shell32.dll, 5
  7. I copied your code, and the second MsgBox shows "Not Found".
  8. Mine can only find internet. No other
  9. Because ini keys cannot contain spaces afaik. But maybe they can? EDIT: They could. The IniRead() returns an emtpy string. It cant't read the key. The ini file: [categories] Internet = shell32.dll, 14 File Management = shell32.dll, 5 It reads the Internet key fine. But not File Management.
  10. Hi, i'm using an ini file to decide icons for some folders in a tray menu. But, when the foldername comtain spaces i get a problem. The icon doesn't show. and the doesn't seem to be found at all For $i = 1 To UBound($categories)-1 ;Add the category to the menu $traycategories[$categories[$i]] = _TrayCreateMenu(-1, $categories[$i]) ;Now we want an icon :D ;Change spaces to unserscores $category_nospace = StringReplace($categories[$i], " ", "_") ;Read the value from the ini file $value = IniRead("VelkyPortable/data/icons.ini", "categories", $category_nospace, "") ;Split the value $icon = StringSplit($value, ",") ;Remove spaces from the number $icon[2] = StringReplace($icon[2], " ", "") If $icon[0] > 1 Then _TrayItemSetIcon(-1, $icon[1], Int($icon[2])) ElseIf $icon[0] = 1 Then _TrayItemSetIcon(-1, $icon[1]) EndIf $apps = _FileListToArray("VelkyPortable/apps/" & $categories[$i], "*", 2) ;Put them in the tray array For $x = 1 To UBound($apps)-1 $traynr[$i][$x] = _TrayCreateItem(-1, $apps[$x], $traycategories[$categories[$i]]) $trayapp[$i][$x] = $apps[$x] _TrayItemSetIcon(-1, "VelkyPortable/apps/" & $categories[$i] & "/" & $trayapp[$i][$x] & "/" & IniRead("VelkyPortable/apps/" & $categories[$i] & "/" & $trayapp[$i][$x] & "/appinfo.ini", "appinfo", "appexe", "../../../data/setup.ico")) Next Next
  11. Okay. Thanks fo the help!
  12. Hi, i've got a strange problem. (Or i done something dumb) I got this code: Dim $clicklist[12] $clicklist["R"] = 8 $clicklist["_R"] = 16 $clicklist["R_"] = 24 $clicklist["L"] = 1 $clicklist["_L"] = 2 $clicklist["L_"] = 3 $clicklist["RL"] = 9 $clicklist["_RL"] = 18 $clicklist["DL"] = 4 $clicklist["DR"] = 32 $clicklist["DRL"] = 36 $clicklist["ALL"] = 64 ;Check if it has a valid value $click = IniRead("VelkyPortable/data/settings.ini", "controls", "click", "") If $click = "" And Not $click = "R" And Not $click = "_R" And Not $click = "R_" And Not $click = "L" And Not $click = "L_" And Not $click = "L_" And Not $click = "RL" And Not $click = "_RL" And Not $click = "DL" And Not $click = "DR" And Not $click = "DRL" And Not $click = "ALL" Then MsgBox(48, "Warning!", "The key 'click' in settings.ini does not have a valid value. Using default 'ALL'") $click = $clicklist["ALL"] Else $click = $clicklist[$click] EndIf MsgBox(0,"",$clicklist["_R"]) But the messagebox shows 64, when it should show 16. I f i comment the '$clicklist["ALL"] = 64' line, the MsgBox shows 36. So it seems to show the latest entry in the array. Why is this happening?
  13. Thanks a LOT! This is just what i've been looking for. Great job!
  14. Hi, i'm having some problem using the event mode with a tray menu. It works fine wih the GUI. $tray_exit = TrayCreateItem("Exit") GUISetOnEvent(-1, "_Quit") I get no error. IT just doesn't work. It doesnt quit. I also tried GUISetOnEvent($tray_exit, "_Quit") But that didn't work either. The _Quit() works when i use events on the GUI. _Quit(): Func _Quit() Exit EndFunc
  15. That wasn't really what i meant But thanks anyways. And i solved the problem. Now i have another one.. ;Dim an array to use when creating the apps in the tray menu Dim $trayapps[UBound($apps)] ;Dim an array to use when creating the categories in the tray menu Dim $traycategory[UBound($categories)] ;Create the categories in thye tray menu For $i = 1 To Ubound($categories)-1 $traycategory[$i] = TrayCreateMenu($categories[$i]) ;Add the apps to the categories For $i = 1 To UBound($apps)-1 $trayapps[$i] = TrayCreateItem($apps[$i], $traycategory[$i]) Next Next That is a piece of my code. And it gives me the error: (41) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $trayapps[$i] = TrayCreateItem($apps[$i], $traycategory[$i]) $trayapps[$i] = TrayCreateItem($apps[$i], ^ ERROR
  16. Hi, i'm having a problem with the array $cmdline. If $CmdLine[0] > 0 Then;Arguments are passed For $i = 1 To UBound($CmdLine) If $CmdLine[$i] = "-i" Then;Input file $inputfile = $CmdLine[$i+1] ElseIf $CmdLine[$i] = "-d" Then;Debug $debug = True EndIf Next EndIf As long i don't pass any argument it works. But, when i pass a argument i get the error: Line 5 (File "path_to_the_script"): If $CmdLine[$i] = "-i" Then If ^ERROR Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.
  17. This isn't true... -.- I never moved the "main.gif" to that folder.
  18. Hi, i recently had a problem with background color. Now i also want an image. I do it like this: #include <GUIConstants.au3> ;Read the GUI size from the config file $width = IniRead("VelkyPortable/config/conf.ini", "gui", "width", 450) $height = IniRead("VelkyPortable/config/conf.ini", "gui", "height", 600) ;Read the left position $left = IniRead("VelkyPortable/config/conf.ini", "gui", "left", "left") If Not StringIsInt($left) Then If StringLower($left) = "left" Then $left = 0 ElseIf StringLower($left) = "right" Then $left = @DesktopWidth - $width EndIf EndIf ;Read the top position $top = IniRead("VelkyPortable/config/conf.ini", "gui", "top", "bottom") If Not StringIsInt($top) Then If StringLower($top) = "top" Then $top = 0 ElseIf StringLower($top) = "bottom" Then $top = @DesktopHeight - $height EndIf EndIf ;Create the gui $gui = GUICreate("VelkyPortable", $width, $height, $left, $top, $WS_POPUP) $pic_main = GUICtrlCreatePic(@ScriptDir & "/VelkyPortable/gfx/main.gif", -1, -1, $width, $height) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend @error is 1 after GUICtrlCreatePic() so the file is found. But the window is just gray. No image. Does anyone know why?
  19. Hi, i want to open a black window. But, it becomes blue. I can't figure out why "/ #include <GUIConstants.au3> ;Read the GUI size from the config file $width = IniRead("VelkyPortable/config/conf.ini", "gui", "width", 450) $height = IniRead("VelkyPortable/config/conf.ini", "gui", "height", 600) ;Read the left position $left = IniRead("VelkyPortable/config/conf.ini", "gui", "left", "left") If Not StringIsInt($left) Then If StringLower($left) = "left" Then $left = 0 ElseIf StringLower($left) = "right" Then $left = @DesktopWidth - $width EndIf EndIf ;Read the top position $top = IniRead("VelkyPortable/config/conf.ini", "gui", "top", "bottom") If Not StringIsInt($top) Then If StringLower($top) = "top" Then $top = 0 ElseIf StringLower($top) = "bottom" Then $top = @DesktopHeight - $height EndIf EndIf ;Create the gui $gui = GUICreate("VelkyPortable", $width, $height, $left, $top, $WS_POPUP) GUISetBkColor($gui, 0x000000) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend It seems to get random colors. It also opened red once..
  20. It must call some DLL in system32 or anything. From the winapi. I meant everything
  21. Hi, what does a "compiled" AutoIt script need to run? Which dll's and such?
  22. Of course i make the same error twice... xD
  23. It found the function in your DLL, but when i tries to show the result using MsgBox(0, "Result", String($c)) is shows an empy MsgBox. :/
  24. It's still the same. It can't find the function. Even thoug i have the exact code you have. (Also used Dev-Cpp)
  25. Does anyone know why the DllCall cannot find the Add() function?
×
×
  • Create New...