goldenix Posted June 4, 2009 Posted June 4, 2009 (edited) Q 1 why wont the global value work hire? I wont have to use strin split if I can use global values but it does not work. expandcollapse popupGlobal $ImageWidth Global $ImageHeight $dimensions = _dimensions('test.jpg') $split = StringSplit($dimensions,' ') $ImageWidth = $split[1] $ImageHeight = $split[2] ConsoleWrite($ImageWidth & ' ' & $ImageHeight & @CRLF) Func _dimensions($file) $ImageWidth = 'xxx' $ImageHeight = 'yyy' ;~ Return $ImageWidth & ' ' & $ImageHeight EndFunc ExitoÝ÷ Ù Ê«²Ø¨+0Ym+,£ éz·è®f§qè"¯{]4ÓMW¬¶!yÉÖ¥)àiº.¶Ø^m+kx¦Xý¸¬¶«j|¨¶«Á¬¢·º¹íëÚ第zÊ&zØb bæÑzÛ«Mú"f yh¶^¶êçÓ~¨è ßÛjëh×6$dimensions = _dimensions('test.jpg') $split = StringSplit($dimensions,' ') $ImageWidth = $split[1] $ImageHeight = $split[2] ConsoleWrite($ImageWidth & ' ' & $ImageHeight & @CRLF) Func _dimensions($file) $ImageWidth = 'xxx' $ImageHeight = 'yyy' Return $ImageWidth & ' ' & $ImageHeight EndFunc Exit Edited June 4, 2009 by goldenix My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Moderators Melba23 Posted June 4, 2009 Moderators Posted June 4, 2009 goldenix,Why not use an array and avoid the StringSplit?Global $aDims[2] _dimensions('test.jpg') $ImageWidth = $aDims[0] $ImageHeight = $aDims[1] ConsoleWrite($ImageWidth & ' ' & $ImageHeight & @CRLF) Func _dimensions($file) $aDims[0] = 'xxx' $aDims[1] = 'yyy' EndFunc ExitM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
stampy Posted June 4, 2009 Posted June 4, 2009 Global seems to work fine without the string split. Global $ImageHeight Global $ImageWidth _dimensions('test.jpg') ConsoleWrite($ImageWidth & ' ' & $ImageHeight & @CRLF) Func _dimensions($file) $ImageWidth = 'xxx' $ImageHeight = 'yyy' EndFunc ExitoÝ÷ Ù.r¥u©l¢¬²Ø^¶©Ý~í)Úªëk&®¶sdFÒb33c¶FÖVç6öç5³%Ð ¢b33c¶FÖVç6öç2ÒöFÖVç6öç2b33·FW7Bæ§rb33²¢¤6öç6öÆUw&FRb33c¶FÖVç6öç5³Òfײb33²b33²fײb33c¶FÖVç6öç5³Òfײ5$Äb ¤gVæ2öFÖVç6öç2b33c¶fÆR¢¢b33c¶FÖVç6öç5³ÒÒb33·b33°¢b33c¶FÖVç6öç5³ÒÒb33·b33°¢¢&WGW&âb33c¶FÖVç6öç0¤VæDgVæ0 ¤W
goldenix Posted June 4, 2009 Author Posted June 4, 2009 humm indeed, looks like global is faster than array ill stick with the global. thanx. My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now